Learn R Programming

crunch (version 1.18.0)

dataset-to-R: as.data.frame method for CrunchDataset

Description

This method is defined principally so that you can use a CrunchDataset as a data argument to other R functions (such as [stats::lm]). Unless you give it the force==TRUE argument, this function does not in fact return a data.frame: it returns an object with an interface like a data.frame, such that you get R vectors when you access its columns (unlike a CrunchDataset, which returns CrunchVariable objects). This allows modeling functions that require select columns of a dataset to retrieve only those variables from the remote server, rather than pulling the entire dataset into local memory.

Usage

# S3 method for CrunchDataset
as.data.frame(x, row.names = NULL, optional = FALSE,
  force = FALSE, row.order = NULL, ...)

# S3 method for CrunchDataFrame as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

a CrunchDataset

row.names

part of as.data.frame signature. Ignored.

optional

part of as.data.frame signature. Ignored.

force

logical: actually coerce the dataset to data.frame, or leave the columns as unevaluated promises. Default is FALSE.

row.order

vector of indeces. Which, and their order, of the rows of the dataset should be presented as (default: NULL). If NULL, then the Crunch Dataset order will be used.

...

additional arguments passed to as.data.frame.default

Value

an object of class CrunchDataFrame unless force, in which case the return is a data.frame.