[R] combining strings

Erin Hodgess erinm.hodgess at gmail.com
Fri Jun 17 03:59:03 CEST 2011


Dear R People:

Suppose I have the following two character vectors:

 xf
 [1] "W" NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA  NA
> xg
 [1] NA  "k" "h" NA  "g" "r" "j" NA  "v" "d" NA  "v" NA  "z" "r" "r" "i"
>

I want to end up with

"W" "k" "h" ...

What is the best way to achieve this, please?  I was thinking that if
there is an exclusive "or" that it might work.  I've tried all kinds
of ifs, and ifelse, to no avail.


Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com



More information about the R-help mailing list