Removes a chunk from the disk.frame

remove_chunk(df, chunk_id, full.names = FALSE)

Arguments

df

a disk.frame

chunk_id

the chunk ID of the chunk to remove. If it's a number then return number.fst

full.names

TRUE or FALSE. Defaults to FALSE. If true then chunk_id is the full path to the chunk otherwise it's the relative path

Examples

# TODO add these to tests cars.df = as.disk.frame(cars, nchunks = 4) # removes 3rd chunk remove_chunk(cars.df, 3)
#> path: "C:\Users\RTX2080\AppData\Local\Temp\RtmpInritK\file187c1fad1470.df" #> nchunks: 3 #> nrow (at source): 37 #> ncol (at source): 2 #> nrow (post operations): ??? #> ncol (post operations): ???
nchunks(cars.df) # 3
#> [1] 3
# removes 4th chunk remove_chunk(cars.df, "4.fst")
#> path: "C:\Users\RTX2080\AppData\Local\Temp\RtmpInritK\file187c1fad1470.df" #> nchunks: 2 #> nrow (at source): 26 #> ncol (at source): 2 #> nrow (post operations): ??? #> ncol (post operations): ???
nchunks(cars.df) # 3
#> [1] 2
# removes 2nd chunk remove_chunk(cars.df, file.path(attr(cars.df, "path", exact=TRUE), "2.fst"), full.names = TRUE)
#> path: "C:\Users\RTX2080\AppData\Local\Temp\RtmpInritK\file187c1fad1470.df" #> nchunks: 1 #> nrow (at source): 13 #> ncol (at source): 2 #> nrow (post operations): ??? #> ncol (post operations): ???
nchunks(cars.df) # 1
#> [1] 1
# clean up cars.df delete(cars.df)