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)
sample_dt(mtcars,n=10)
sample_dt(mtcars,prop = 0.1)
# sample by group(s)
iris %>% sample_n_dt(2,by = "Species")
iris %>% sample_frac_dt(.1,by = "Species")
mtcars %>% sample_n_dt(1,by = "cyl,vs")
# equals to
mtcars %>% sample_n_dt(1,by = c("cyl","vs"))