creating new variable from variable in frame

I am a newbie to R...
I have a data frame with a column "accnt". How do I assign the new variable "defer" to "Y" if accnt is between 5 and 9 inclusive, otherwise assign "N"?

Here is a simple method:

DF$defer <- ifelse(DF$accnt >= 5 & DF$accnt <= 9, "Y", "N")

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.