# Say you have a data.frame stored in a parquet format, such as this one
demo <-
data.table::data.table(
UMCReportId = c(1, 2, 3, 4),
AgeGroup = c(1, 7, 7, 8)
) |>
arrow::as_arrow_table()
tmp_folder <- paste0(tempdir(), "/dtparquetex")
dir.create(tmp_folder)
path_data <- paste0(tmp_folder, "/")
arrow::write_parquet(demo,
sink = paste0(path_data, "demo.parquet")
)
# Now you have a new session without demo
rm(demo)
# You may import the file directly to data.table format with dt_parquet
demo <-
dt_parquet(path_data, "demo")
# Clean up (required for CRAN checks)
unlink(tmp_folder, recursive = TRUE)
Run the code above in your browser using DataLab