llrs / experDesign

Design experiments distributed in several batches
https://experDesign.llrs.dev
Other
10 stars 1 forks source link

Make sure that one variable is possible to use #20

Closed llrs closed 3 years ago

llrs commented 4 years ago

This shouldn't be an error:

pheno <- data.frame(fish = 1:50, type = rep(LETTERS[1:5], length.out = 50))
i <- experDesign::design(pheno[ , "type", drop = FALSE], size_subset = 250)
i <- experDesign::replicates(pheno[ , "type", drop = FALSE], size_subset = 250, controls = 5)

This might need to check if the data.frame has one column only and deal with it. (I don't understand now why it fails, but it seems like on the subsetting on categorical and numeric I should add a drop = FALSE.


From tweet:

How does one take a random sample of size Y with at least X elements per group? I.e sample n=250 rows from a df with fish of diff ages, with at least 5 rows per age.

llrs commented 4 years ago

The code provided triggers an error because there is only one batch. Perhaps it should be catch earlier?