I have a variable that identifies citizen type but some of my rows are blank. I want to replace the blank entries with the correct value which is conditional on another variable. In SAS, my conditional statement would be as follow:
if citizenType="" and primarylanguage="English" then citizenType ="US citizen"; else citizenType=citizenType;
When I try to duplicate this conditional statement in R I get the following error: Will you show me the correct syntax? 
social$CitizenType<-if(social$CitizenType=="" ||social$PrimaryLanguage=="English","US Citizen" )
Error: unexpected ',' in "social$CitizenType<-if(social$CitizenType=="" ||social$PrimaryLanguage=="English","
 
 social$CitizenType<-if(social$CitizenType=="" && social$PrimaryLanguage=="English","US Citizen" )
Error: unexpected ',' in "social$CitizenType<-if(social$CitizenType=="" && social$PrimaryLanguage=="English","

social$CitizenType[social$CitizenType==""]<-if(social$CitizenType[social$CitizenType==""] && social$PrimaryLanguage[social$PrimaryLanguage=="English"],"US Citizen" )
Error: unexpected ',' in "social$CitizenType[social$CitizenType==""]<-if(social$CitizenType[social$CitizenType==""] && social$PrimaryLanguage[social$PrimaryLanguage=="English"],"
> 

Chris Anderson
707.315.8486
www.sassydeals4u.com
____________________________________________________________
Click now for prescreened plumbing contractors.
http://thirdpartyoffers.netzero.net/TGL2241/fc/BLSrjpYePbmJll7hN4GC9GCio2T0Hpy2G8xkxYL2nS71xPBRcqvSBxjyBqQ/
	[[alternative HTML version deleted]]


