Learn R Programming

crunch (version 1.18.0)

exportDataset: Export a dataset to a file

Description

Export a dataset to a file

Usage

exportDataset(dataset, file, format = c("csv", "spss"),
  categorical = c("name", "id"), na = NULL, varlabel = c("name",
  "description"), ...)

# S4 method for CrunchDataset write.csv(x, ...)

Arguments

dataset

CrunchDataset, which may have been subsetted with a filter expression on the rows and a selection of variables on the columns.

file

character local filename to write to

format

character export format: currently supported values are "csv" and "spss".

categorical

character: export categorical values to CSV as category "name" (default) or "id". Ignored by the SPSS exporter.

na

Similar to the argument in write.table, 'na' lets you control how missing values are written into the CSV file. Supported values are (1) NULL, the default, which means that categorical variables will have the category name or id as the value, and numeric, text, and datetime variables will have the missing reason string; (2) a string to use for missing values. "" means that empty cells will be written for missing values for all types.

varlabel

For SPSS export, which Crunch metadata field should be used as variable labels? Default is "name", but "description" is another valid value.

...

additional options. See the API documentation. Currently supported boolean options include 'include_personal' for personal variables (default: FALSE) and 'prefix_subvariables' for SPSS format: whether to include the array variable's name in each of its subvariables varlabels (default: FALSE).

x

(for write.csv) CrunchDataset, which may have been subsetted with a filter expression on the rows and a selection of variables on the columns.

Value

Invisibly, file.