# NOT RUN {
# Sample dataset
x <- data.frame(A = 1:10000, B = sample(c(TRUE, FALSE, NA), 10000, replace = TRUE))
# Default compression
fst_file <- tempfile(fileext = ".fst")
write_fst(x, fst_file) # filesize: 17 KB
y <- read_fst(fst_file) # read fst file
# Maximum compression
write_fst(x, fst_file, 100) # fileSize: 4 KB
y <- read_fst(fst_file) # read fst file
# Random access
y <- read_fst(fst_file, "B") # read selection of columns
y <- read_fst(fst_file, "A", 100, 200) # read selection of columns and rows
# }
Run the code above in your browser using DataLab