Apologies for a likely naive question.
I am trying to create a discriminating dummy variable using 'ifelse' based on
conditions in two variables.
Specifically, I want to assign levels in a new factor as '0' or '1' based on a
user-defined cut off. I.e. something similar to:
Which is all straightforward.
But how do I go on to assign values in variable 'molecule'based on the same cut
off, but separately for each level of a second variable, in this case the
factor 'fruit' with three levels. That is, how do I derive fruit-specific
cut-offs using a data frame with the general structure of that below?
Many thanks in advance!
[[alternative HTML version deleted]]
Rfirstname.lastname@example.org mailing list -- To UNSUBSCRIBE and more, see
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.