aou_collect {allofus} | R Documentation |
Collect a tbl object and convert integer64 columns to double
Description
If you connect to the All of Us database via aou_connect()
,
integer columns will be converted to the int64 class, which can represent
64-bit integers. This is safer than keeping as R's default integer class,
because some of the values of the ID columns in All of Us are larger than R
can handle as integers. However, this can make working with the local table
more difficult in RStudio as a vector of values will not match the int64
class. This is not a problem in Jupyter notebooks, meaning that code that
works on one platform may not work on another. A safe practice is to use
aou_collect()
, which works just like dplyr::collect()
except that any
integer values are converted to doubles. If this is not what you want, set
convert_int64 = FALSE
.
Usage
aou_collect(data, convert_int64 = TRUE, ...)
Arguments
data |
A reference to a remote database table (or unexecuted query) |
convert_int64 |
Do you want to convert integer values to doubles?
Defaults to |
... |
Other arguments passed to dplyr::collect() |
Details
Value
a local dataframe
Examples
# returns 2 rows, as expected
dplyr::tbl(con, "concept") %>%
dplyr::filter(concept_id %in% c(1112807, 4167538)) %>%
aou_collect() %>%
dplyr::filter(concept_id %in% c(1112807, 4167538))
default_collect <- tbl(con, "concept") %>%
dplyr::filter(concept_id %in% c(1112807, 4167538)) %>%
dplyr::collect()
# returns 2 rows in Jupyter and 0 in RStudio
dplyr::filter(default_collect, concept_id %in% c(1112807, 4167538))