synapser::as.data.frame collides with other S4 as.data.frame methods

Description

Related to SYNR-1178.

I can run this:

1 2 3 4 5 6 7 library(synapser) library(magrittr) synLogin() query <- "select * from syn123456" d <- synapser::synTableQuery(query) %>% as.data.frame()

But not when it's wrapped into a function:

1 2 3 4 5 6 7 #' @export syn_get_curated_data <- function(id) { query <- glue::glue("select * from {id}") d <- synapser::synTableQuery(query)$asDataFrame() %>% tibble::as_tibble() return(d) }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 Error in as.data.frame.default(.) : cannot coerce class ‘c("CsvFileTable", "PythonInR_Object", "R6")’ to a data.frame 11. stop(gettextf("cannot coerce class %s to a data.frame", sQuote(deparse(class(x))[1L])), domain = NA) 10. as.data.frame.default(.) 9. as.data.frame(.) 8. function_list[[i]](value) 7. freduce(value, `_function_list`) 6. `_fseq`(`_lhs`) 5. eval(quote(`_fseq`(`_lhs`)), env, env) 4. eval(quote(`_fseq`(`_lhs`)), env, env) 3. withVisible(eval(quote(`_fseq`(`_lhs`)), env, env)) 2. synapser::synTableQuery(query) %>% as.data.frame(.) %>% tibble::as_tibble() at read.R#4 1. syn_get_curated_data(id)

Switching to this works:

1 2 d <- synapser::synTableQuery(query)$asDataFrame() %>% tibble::as_tibble()

Environment

None

Status

Assignee

Unassigned

Reporter

Kenneth Daily

Labels

None

Validator

Kara Woo

Release Version History

None

Components

Sprint

None

Fix versions

Priority

Major
Configure