persist: Copy an xdf tbl to a permanent storage location.

Description Usage Arguments Details Value See Also Examples

Description

Copy an xdf tbl to a permanent storage location.

Usage

1
2
3
4
5
6
7
8
persist(.data, ...)

## S3 method for class 'tbl_xdf'
persist(.data, file, composite = is_composite_xdf(.data),
  move = TRUE, overwrite = TRUE, ...)

## S3 method for class 'RxFileData'
persist(.data, ...)

Arguments

.data

An xdf tbl

...

Other arguments to rxDataStep

file

Character string giving the name of the output xdf file

composite

Create a composite Xdf or normal? The default is to create the same type of file as the input.

move

Should the tbl file be moved or copied?

overwrite

If the outfile already exists, should it be overwritten?

Details

By default, the underlying data for an xdf tbl is saved as a file in the R temporary directory, and is managed by dplyrXdf. This can cause confusion and errors when a tbl is reused by later dplyrXdf operations, which can overwrite or delete the data.

The persist verb is a simple routine that either copies or moves the data into a new Xdf file at the location given by outFile. This ensures that the data will not be modified by dplyrXdf, and will be persistent beyond the end of the R session.

Calling this verb on a non-tbl data source (eg a raw RxXdfData object) will give a warning and return the data source unchanged.

Value

An RxXdfData object pointing to the new xdf file.

See Also

as_xdf, as.data.frame.RxXdfData, rxDataStep

Examples

1
2
3
4
mtx <- as_xdf(mtcars, overwrite=TRUE)
tbl <- mutate(mtx, mpg2=2 * mpg)
persist(tbl, "mtcars_mutate.xdf", move=FALSE)
persist(tbl, "mtcars-composite", composite=TRUE)  # composite Xdf names cannot contain _ or .

RevolutionAnalytics/dplyrXdf documentation built on June 3, 2019, 9:08 p.m.