Sample n rows from a disk.frame
# S3 method for disk.frame
sample_frac(tbl, size = 1, replace = FALSE, weight = NULL, .env = NULL, ...)
A data.frame.
<tidy-select
>
For sample_n()
, the number of rows to select.
For sample_frac()
, the fraction of rows to select.
If tbl
is grouped, size
applies to each group.
Sample with or without replacement?
<tidy-select
> Sampling weights.
This must evaluate to a vector of non-negative numbers the same length as
the input. Weights are automatically standardised to sum to 1.
DEPRECATED.
ignored
# NOT RUN {
cars.df = as.disk.frame(cars)
collect(sample_frac(cars.df, 0.5))
# clean up cars.df
delete(cars.df)
# }
Run the code above in your browser using DataLab