search for: 303190

Displaying 1 result from an estimated 1 matches for "303190".

Did you mean: 003190
2007 Feb 19
5
categorical column to numeric column
Hi R, Let 'dd' be a data frame given as: dd=data.frame(aa=c("a","a","b","a","b","b"),bb=c(1,1,1,2,3,4)) Now I want to create a column 'g' such that if dd$aa=a then dd$g=1 else dd$g= -1 . So, I gave the below syntax: if((dd$aa)=="a") dd$g=1 else dd$g= -1 But I get the error message as: