Write a data.frame/disk.frame to a disk.frame location. If df is a data.frame then using the as.disk.frame function is recommended for most cases

write_disk.frame(
  df,
  outdir = tempfile(fileext = ".df"),
  nchunks = ifelse("disk.frame" %in% class(df), nchunks.disk.frame(df),
    recommend_nchunks(df)),
  overwrite = FALSE,
  shardby = NULL,
  compress = 50,
  shardby_function = "hash",
  sort_splits = NULL,
  desc_vars = NULL,
  ...
)

output_disk.frame(...)

Arguments

df

a disk.frame

outdir

output directory for the disk.frame

nchunks

number of chunks

overwrite

overwrite output directory

shardby

the columns to shard by

compress

compression ratio for fst files

shardby_function

splitting of chunks: "hash" for hash function or "sort" for semi-sorted chunks

sort_splits

for the "sort" shardby function, a dataframe with the split values.

desc_vars

for the "sort" shardby function, the variables to sort descending.

...

passed to cmap.disk.frame

Examples

cars.df = as.disk.frame(cars) # write out a lazy disk.frame to disk cars2.df = write_disk.frame(cmap(cars.df, ~.x[1,]), overwrite = TRUE) collect(cars2.df)
#> speed dist #> 1: 4 2 #> 2: 11 17 #> 3: 13 46 #> 4: 16 40 #> 5: 19 46 #> 6: 24 70
# clean up cars.df delete(cars.df) delete(cars2.df)