R experts,
I have been unable to get the following ifelse statement to work as desired
when applied
to my data frame.
Example:
DF$ANYEF -
with(DF,ifelse(PSOUGHT1=='ANY'|PSOUGHT2=='ANY'|PSOUGHT3=='ANY',PEFF,0))
# this statement will be replicated 16 times for 16 unique _EF variables
Hi Mike,
Probably the simplest way from what you have done would be to just set
any NA values in the column to 0:
DF$ANYEF[is.na(DF$ANYEF)] - 0
Alternately, you can try this. It should work, but it is far from elegant.
DF$ANYEF - with(DF, ifelse(
rowSums(cbind(PSOUGHT1, PSOUGHT2, PSOUGHT3)
...@gmail.com]
Sent: Tuesday, July 20, 2010 1:41 PM
To: Hosack, Michael
Cc: r-help@r-project.org
Subject: Re: [R] ifelse() and missing values in test conditions
Hi Mike,
Probably the simplest way from what you have done would be to just set
any NA values in the column to 0:
DF$ANYEF[is.na(DF$ANYEF
3 matches
Mail list logo