[R] Vector Manipulation

Doran, Harold HDoran at air.org
Fri Jun 16 22:48:07 CEST 2006


I think you want

ifelse(x=='N',0,1) 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Davis, 
> Jacob B. 
> Sent: Friday, June 16, 2006 4:46 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Vector Manipulation
> 
> I have a vector that has 1,974 elements and each element is 
> one of the following (B, F, N, Y).  How do I recreate that 
> vector accept in the place of N put 0 and in the place of B, 
> F or Y put a 1?
> 
>  
> 
> Thanks,
> 
> Jacob
> 
>  
> 
>  
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>



More information about the R-help mailing list