powered by
Analogous function for sample_n and sample_frac in dplyr.
sample_n
sample_frac
sample_n_dt(data, size, replace = FALSE)sample_frac_dt(data, size, replace = FALSE)
sample_frac_dt(data, size, replace = FALSE)
data.frame
sample_n_dt(), the number of rows to select. For sample_frac_dt, the fraction of rows to select.
sample_n_dt()
sample_frac_dt
Sample with or without replacement? Default uses FALSE.
FALSE
data.table
sample_n,sample_frac
# NOT RUN { sample_n_dt(mtcars, 10) sample_n_dt(mtcars, 50, replace = TRUE) sample_frac_dt(mtcars, 0.1) sample_frac_dt(mtcars, 1.5, replace = TRUE) # }
Run the code above in your browser using DataLab