make_my_data2L.Rd
Currently only works with data with 2-levels. Notes that if the size of the dataframe is too small to accomodate n.sample then with.rep is set to TRUE.
make_my_data2L( dat, my.code = "nlb24", cat.var, n.sample = 20, with.rep = FALSE )
dat | R dataframe to randomly subset |
---|---|
my.code | Unique code, such as your email address. Must contain only letters and numbers and not the at symbol or other punctuation. |
cat.var | Categorical variable by which to split the data up |
n.sample | Number of samples per group to randomly select. 2*n.sample will be the total size of the dataframe. |
with.rep | Should sampling be with replacement? If with.rep = TRUE then individuals can occur more than once within the dataframe. |
#Subset frogarms data data(frogarms) my.frogs <- make_my_data2L(dat = frogarms, my.code = "nlb24", cat.var = "sex", n.sample = 20, with.rep = FALSE) summary(my.frogs)#> i.row i.frog sex mass sv.length #> Min. : 79.0 Min. : 80.0 female:20 Min. :0.810 Min. :23.46 #> 1st Qu.:180.5 1st Qu.:181.5 male :20 1st Qu.:1.913 1st Qu.:28.68 #> Median :436.0 Median :441.0 Median :2.170 Median :31.55 #> Mean :333.1 Mean :337.0 Mean :2.585 Mean :31.96 #> 3rd Qu.:461.8 3rd Qu.:467.8 3rd Qu.:3.325 3rd Qu.:34.33 #> Max. :497.0 Max. :504.0 Max. :6.680 Max. :41.77 #> #> forearm arm i.rows.working #> Min. :1.160 Min. :1.460 Min. : 79.0 #> 1st Qu.:2.200 1st Qu.:1.988 1st Qu.:180.5 #> Median :2.865 Median :3.055 Median :436.0 #> Mean :2.944 Mean :3.445 Mean :333.1 #> 3rd Qu.:3.533 3rd Qu.:4.438 3rd Qu.:461.8 #> Max. :5.220 Max. :7.750 Max. :497.0 #> NA's :2 NA's :2