library(dbplyr)
library(dplyr)
## example data
df <- tibble::tibble(apples = 1:3, oranges = c("a", "b", "c"))
## example SQLite db
db <- src_sqlite(tempfile(), create = TRUE)
## a real SQLite tbl
real_tbl <- copy_to(db, df)
## a simulated SQLite tbl
sim_tbl <- tbl_lazy(df, simulate_sqlite())
## NA, as expected
nrow(real_tbl)
## NULL, not expected
nrow(sim_tbl)
My question is, should nrow(real_tbl) return NA? How does that work though, I'm confused about the ops_ control here.
The problem comes with the print:
## this causes printing to fail in trunc_mat
print(sim_tbl)
#Error in if (
is.na(rows) || rows > tibble_opt("print_max")) { :
# missing value where TRUE/FALSE needed
# In addition: Warning message:
# In
is.na(rows) :
is.na() applied to non-(list or vector) of type 'NULL'
## though other ops do work
str(op_base(real_tbl, "apples"))
str(op_base(sim_tbl, "apples"))