View source: R/SQLColumnSeed.R
SQLColumnSeed | R Documentation |
Represent a column of a SQL table as a 1-dimensional DelayedArray. This allows us to use SQL data inside DataFrames without loading them into memory.
SQLColumnSeed(path, dbtype, table, column, length = NULL, type = NULL)
SQLColumnVector(x, ...)
path |
String containing a path to a SQL file. |
dbtype |
String containing the SQL database type (case insensitive). Supported types are "SQLite" and "DuckDB". |
table |
String containing the name of the table in SQL file. |
column |
String containing the name of the column inside the table. |
length |
Integer containing the number of rows. If
|
type |
String specifying the type of the data. If |
x |
A SQLColumnSeed object. |
... |
Further arguments to be passed to the
|
For SQLColumnSeed
: a SQLColumnSeed. For
SQLColumnVector
: a SQLColumnVector.
#'
Qian Liu
# Mocking up a file:
tf <- tempfile()
on.exit(unlink(tf))
con <- DBI::dbConnect(RSQLite::SQLite(), tf)
DBI::dbWriteTable(con, "mtcars", mtcars)
DBI::dbDisconnect(con)
# Creating a vector:
SQLColumnVector(tf, dbtype = "SQLite", "mtcars", column="gear")
# This happily lives inside DataFrames:
collected <- list()
for (x in colnames(mtcars)) {
collected[[x]] <- SQLColumnVector(tf, dbtype = "SQLite", "mtcars", column=x)
}
DataFrame(collected)
#'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.