# Simple usage
x <- matrix(seq_len(20), nrow = 5)
x
drake_slice(x, slices = 3, index = 1)
drake_slice(x, slices = 3, index = 2)
drake_slice(x, slices = 3, index = 3)
drake_slice(x, slices = 3, margin = 2, index = 1)
# In drake, you can split a large dataset over multiple targets.
if (FALSE) {
isolate_example("contain side effects", {
plan <- drake_plan(
large_data = mtcars,
data_split = target(
drake_slice(large_data, slices = 32, index = i),
transform = map(i = !!seq_len(32))
)
)
plan
cache <- storr::storr_environment()
make(plan, cache = cache, session_info = FALSE, verbose = FALSE)
readd(data_split_1L, cache = cache)
readd(data_split_2L, cache = cache)
})
}
Run the code above in your browser using DataLab