Read a variable as a tidy data frame
Source:R/connection.R
dbReadTable-XarrayConnection-character-method.RdThe rendering is the tidy long form of ds[name], exactly as
to_dataframe().reset_index() gives it: one row per cell, every
coordinate as a column. This materializes the variable, so it is
guarded: reads above max_cells cells error unless force = TRUE.
Set options(xrdbi.max_cells = ) to taste.
Usage
# S4 method for class 'XarrayConnection,character'
dbReadTable(
conn,
name,
...,
max_cells = getOption("xrdbi.max_cells", 1e+07),
force = FALSE
)See also
tbl() or a statement (XarrayResult) to read part of a variable; the guard's option in xrdbi-package.
Examples
if (FALSE) { # \dontrun{
## needs a Python environment with xarray (see ?xrdbi)
f <- system.file("extdata/autotest/trmm.nc", package = "xrdbi")
con <- dbConnect(xarray(), f)
dbReadTable(con, "latitude")
head(dbReadTable(con, "pcp"))
## the guard: 1600 cells is over a limit of 100
try(dbReadTable(con, "pcp", max_cells = 100))
} # }