get_chunk: Obtain one chunk by chunk id

View source: R/get_chunk.r

get_chunkR Documentation

Obtain one chunk by chunk id

Description

Obtain one chunk by chunk id

Usage

get_chunk(...)

## S3 method for class 'disk.frame'
get_chunk(df, n, keep = NULL, full.names = FALSE, ..., partitioned_info = NULL)

Arguments

...

passed to fst::read_fst or whichever read function is used in the backend

df

a disk.frame

n

the chunk id. If numeric then matches by number, if character then returns the chunk with the same name as n

keep

the columns to keep

full.names

whether n is the full path to the chunks or just a relative path file name. Ignored if n is numeric

partitioned_info

for internal use only. It's a data.frame used to help with filtering by partitions

Examples

cars.df = as.disk.frame(cars, nchunks = 2)
get_chunk(cars.df, 1)
get_chunk(cars.df, 2)
get_chunk(cars.df, 1, keep = "speed")

# if full.names = TRUE then the full path to the chunk need to be provided
get_chunk(cars.df, file.path(attr(cars.df, "path"), "1.fst"), full.names = TRUE)

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

disk.frame documentation built on Aug. 24, 2023, 5:09 p.m.