Removes a chunk from the disk.frame
remove_chunk(df, chunk_id, full.names = FALSE)
a disk.frame
the chunk ID of the chunk to remove. If it's a number then return number.fst
TRUE or FALSE. Defaults to FALSE. If true then chunk_id is the full path to the chunk otherwise it's the relative path
# 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\RtmpCo1OFr\file2b648404f5a.df"
#> nchunks: 3
#> nrow (at source): 37
#> ncol (at source): 2
nchunks(cars.df) # 3
#> [1] 3
# removes 4th chunk
remove_chunk(cars.df, "4.fst")
#> path: "C:\Users\RTX2080\AppData\Local\Temp\RtmpCo1OFr\file2b648404f5a.df"
#> nchunks: 2
#> nrow (at source): 26
#> ncol (at source): 2
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\RtmpCo1OFr\file2b648404f5a.df"
#> nchunks: 1
#> nrow (at source): 13
#> ncol (at source): 2
nchunks(cars.df) # 1
#> [1] 1
# clean up cars.df
delete(cars.df)