gaynorr / AlphaSimR

R package for breeding program simulations
https://gaynorr.github.io/AlphaSimR/
Other
40 stars 17 forks source link

Enable passing function or misc slots to the use argument in selection functions #173

Closed gregorgorjanc closed 6 months ago

gregorgorjanc commented 6 months ago

Is your feature request related to a problem? Please describe.

Sometimes we want to do some special type of selection that is not covered by the use and trait arguments of the select functions. use can be one of c("gv", "bv", "pheno", "ebv"), but what if I want to select on a genotype for a specific locus or on a slot on the misc slot?

Describe the solution you'd like

I like that for the trait argument of the select functions I can pass in a function. I think that if we enable passing of a function to the use argument in addition to the trait argument, then we have a very flexible system that could cater for endles options.

Describe alternatives you've considered

I think that only a simple fix to the getResponse() function would be needed.

Additional context

Happy to lead this change, but wanted to lay out the plan here before jumping in to hear thoughts from others.

gaynorr commented 6 months ago

Yes, I think just a change to getResponse() is needed. Feel free to go ahead and make this change. It's probably more work to update all the documentation for this change than actually making the change.