Closed gregorgorjanc closed 2 years ago
In one project we used a traitIndMask
- we create a custom setPhenoCow()
function anyway (that calls setPheno()
) and we added an argument traitIndMask
, which is a logical matrix that a user provides (if NULL
we don't do anything) and we then set phenotypes to NA based on the logicals. This means we can then decide which individuals gets phenotypes for which traits. This is very relevant for some species and breeding programmes, where only some individuals are phenotyped for some traits.
One can do all this differently, but since its quite a common operation it would make sense to have an AlphaSimR solution.
The functionality to set a subset of traits is being added with the "traits" arguments. It will default to doing all traits and thus maintain current behavior without additional arguments.
Possible future features, but discussion needed.
Sometimes we would like to phenotype individuals only for a specific trait. Currently
setPheno()
generates phenotypes for all traits for all individuals in a population.Addition of an argument
trait
tosetPheno()
would allow for more flexibility, but the code would likely be more complicated in the case of environmental covariances - if we would want to keep an already simulated phenotype we would have to do conditional simulation taking the previously simulated error for the previous trait into account. It would also mean it would not replace existing phenotype as it does currently.Related to this is the fact that we currently phenotype all individuals in a population. What if we want to phenotype just a subset. Currently this is best done by splitting the population into two - phenotyped and non-phenotyped or by post-processing phenotypes (setting NA in the
pop@pheno
or in other containers outside of thepop
). For exampleselectInd()
has ancandidates
argument for similar reasons.