as.disk.frame {disk.frame}R Documentation

Make a data.frame into a disk.frame

Description

Make a data.frame into a disk.frame

Usage

as.disk.frame(
  df,
  outdir = tempfile(fileext = ".df"),
  nchunks = recommend_nchunks(df),
  overwrite = FALSE,
  shardby = NULL,
  compress = 50,
  ...
)

Arguments

df

a disk.frame

outdir

the output directory

nchunks

number of chunks

overwrite

if TRUE the outdir will be overwritten, if FALSE it will throw an error if the directory is not empty

shardby

The shardkey

compress

the compression level 0-100; 100 is highest

...

passed to output_disk.frame

Examples

# write to temporary location
cars.df = as.disk.frame(cars) 

# specify a different path in the temporary folder, you are free to choose a different folder
cars_new_location.df = as.disk.frame(cars, outdir = file.path(tempdir(), "some_path.df"))

# specify a different number of chunks
# this writes to tempdir() by default
cars_chunks.df = as.disk.frame(cars, nchunks = 4, overwrite = TRUE) 

# clean up
delete(cars.df)
delete(cars_new_location.df)
delete(cars_chunks.df)

[Package disk.frame version 0.8.3 Index]