read_cnt | R Documentation |
Generic implementing of how to read content from the different connector objects:
ConnectorDBI: Uses DBI::dbReadTable()
to read the table from the DBI connection.
ConnectorFS: Uses read_file()
to read a given file.
The underlying function used, and thereby also the arguments available
through ...
depends on the file extension.
read_cnt(connector_object, name, ...)
## S3 method for class 'ConnectorDBI'
read_cnt(connector_object, name, ...)
## S3 method for class 'ConnectorFS'
read_cnt(connector_object, name, ...)
connector_object |
Connector The connector object to use. |
name |
character Name of the content to read, write, or remove. Typically the table name. |
... |
Additional arguments passed to the method for the individual connector. |
R object with the content. For rectangular data a data.frame.
# Read table from DBI database
cnt <- connector_dbi(RSQLite::SQLite())
cnt |>
write_cnt(iris, "iris")
cnt |>
list_content_cnt()
cnt |>
read_cnt("iris") |>
head()
# Write and read a CSV file using the file storage connector
folder <- withr::local_tempdir()
cnt <- connector_fs(folder)
cnt |>
write_cnt(iris, "iris.csv")
cnt |>
read_cnt("iris.csv") |>
head()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.