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(
diskf,
outdir = tempfile(fileext = ".df"),
nchunks = ifelse("disk.frame" %in% class(diskf), nchunks.disk.frame(diskf),
recommend_nchunks(diskf)),
overwrite = FALSE,
shardby = NULL,
partitionby = NULL,
compress = 50,
...
)
output_disk.frame(...)
a disk.frame
output directory for the disk.frame
number of chunks
overwrite output directory
the columns to shard by
the columns to (folder) partition by
compression ratio for fst files
passed to cmap.disk.frame
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)