Learn R Programming

crunch (version 1.30.4)

newDataset: Upload data to Crunch to make a new dataset

Description

This function creates a new dataset on the Crunch server with either a data.frame or similar object in your R session, a file, or a URL to a file. It captures available metadata from your R object and translates it into Crunch types.

Usage

newDataset(x, name = NULL, ...)

Value

If successful, an object of class CrunchDataset.

Arguments

x

a data.frame or other rectangular R data object, or a string file name or URL to upload to create a dataset. The file may be a compressed Zip file containing a single file in CSV or SPSS format.

name

character name to give the new Crunch dataset. By default the function uses the name of the R object, or, if passing a file, the file name.

...

additional arguments passed to createDataset(), or schema if you're upload Triple-S

Details

If you have an SPSS file, it is better specify the file name directly rather than first reading it into R. Uploading SPSS files directly to Crunch will preserve metadata that is stripped by the R import, regardless of the library used to read it into R.

If you have Triple-S files, you can import those directly to Crunch like you can with SPSS files. You should use the filename to the data file (ending in .asc or .dat) as the x argument and use the metadata file (ending in .sss or .xml) as the schema argument.

See Also

newDatasetFromFile(); newDatasetByColumn() for an alternate upload method.

Examples

Run this code
if (FALSE) {
ds <- newDataset(mtcars, "cars")
ds <- newDataset("mysurvey.sav")
}

Run the code above in your browser using DataLab