The idea behind the treatment of NAs is that if you don't know what the
value is, how do you know if it's 1 or not (in your case)? Therefore, it's
normal that the result to your query is NA.
First, I guess your command was supposed to be:
y <- ifelse(x==1, 'NO', 'YES')
Secondly, if you want to igno
... Well, the syntax is corrected, but it doesn't solve her problem:
ifelse() leaves NA's as NA's.
"But:, you ask, "what should NA's become?" As the OP does not tell
us, we are left to read tea leaves: only the Shadow knows...*
Cheers,
Bert
* The Shadow also knows about ?is.na, which the OP sh
Hello Ana,
The syntax is:
y <- ifelse(x==1, 'YES', 'NO')
Hope this helps,
Pascal
On 10 February 2014 13:03, Ana Genkova wrote:
> Hello,
>
> I am trying the ifelse command for imputing a variable based on a
> conditional statement, but the NAs do not transform. The code I am trying
> is:
>
> if
On Feb 9, 2014, at 8:03 PM, Ana Genkova wrote:
> Hello,
>
> I am trying the ifelse command for imputing a variable based on a
> conditional statement, but the NAs do not transform. The code I am trying
> is:
>
> ifelse (x==1, y=="NO", y=="YES"). However, the number of NAs remains the
> same a
On 02/10/2014 03:03 PM, Ana Genkova wrote:
Hello,
I am trying the ifelse command for imputing a variable based on a
conditional statement, but the NAs do not transform. The code I am trying
is:
ifelse (x==1, y=="NO", y=="YES"). However, the number of NAs remains the
same after the attempt.
On Feb 19, 2011, at 5:14 PM, David Winsemius wrote:
On Feb 19, 2011, at 4:36 PM, Krishnan Viswanathan wrote:
I am trying to recode a variable into another variable and while
the package
'car' works well when it is only recoding A into B, I am not sure I
can do
the same with recoding (A or
On Feb 19, 2011, at 4:36 PM, Krishnan Viswanathan wrote:
I am trying to recode a variable into another variable and while the
package
'car' works well when it is only recoding A into B, I am not sure I
can do
the same with recoding (A or C) into B. If i can use recode please
advise on
how
Should be (I think): (default condition and the use of "|" instead of "||")
social$CitizenType<-if(social$CitizenType=="" |
social$PrimaryLanguage=="English","US Citizen", social$CitizenType )
On Thu, Jul 2, 2009 at 7:19 AM, jim holtman wrote:
> I think you want to use 'ifelse':
>
> social$Citize
I think you want to use 'ifelse':
social$CitizenType<-ifelse(social$CitizenType==""
||social$PrimaryLanguage=="English","US Citizen" )
On Wed, Jul 1, 2009 at 5:45 PM, Chris Anderson wrote:
> I have a variable that identifies citizen type but some of my rows are blank.
> I want to replace the bla
9 matches
Mail list logo