Learn R Programming

dbi.table (version 1.0.4)

as.data.frame: Coerce to a Data Frame

Description

Execute a dbi.table's underlying SQL query and return the result set as a data.frame. By default, the result set is limited to 10,000 rows. See Details.

Usage

# S3 method for dbi.table
as.data.frame(
  x,
  row.names = NULL,
  optional = FALSE,
  ...,
  n = getOption("dbitable.max.fetch", 10000L)
)

Value

a data.frame.

Arguments

x

a dbi.table.

row.names

a logical value. This argument is not used.

optional

a logical value. This argument is not used.

...

additional arguments are ignored.

n

an integer value. When nonnegative, the underlying SQL query includes a 'LIMIT n' clause and n is also passed to dbFetch. When negative, the underlying SQL query does not include a LIMIT clause and all rows in the result set are returned.

Details

By default, as.data.frame returns up to 10,000 rows (see the n argument). To override this limit, either call as.data.frame and provide the n argument (e.g., n = -1 to return the entire result set), or set the option dbitable.max.fetch to the desired default value of n.

See Also

as.data.frame (the generic method in the base package).

Examples

Run this code
  duck <- chinook.duckdb()
  Artist <- dbi.table(duck, DBI::Id("Artist"))

  as.data.frame(Artist, n = 7)[]

  DBI::dbDisconnect(duck)

Run the code above in your browser using DataLab