
Hi, 



Sorry, the answers are yes yes yes. And thank you for your idea it works perfectly.


Regards



Patricia



> Date: Wed, 28 Jan 2009 16:01:11 +0100
> Subject: Re: [R] Merge two vectors into one.
> From: csardi@rmki.kfki.hu
> To: kurtney_84@hotmail.com
> CC: r-help@r-project.org
> 
> Is position important? The vectors always have the same length? They
> always have the same entry if both are not NA?
> 
> If yes, yes and yes, then
> 
> res <- ifelse( is.na(x), y, x)
> 
> does what you want. Otherwise please explain better what you want.
> 
> Gabor
> 
> On Wed, Jan 28, 2009 at 3:54 PM, patricia garcía gonzález
> <kurtney_84@hotmail.com> wrote:
> >
> > Hi all,
> >
> > I have two vectors like this:
> >
> >
> >      x <- c( "Y", "H", NA,  NA )
> >
> >    y <- c( NA,  "H", NA,  "B" )
> >
> > And would like to make one vector with the common elements, and the element available only in one of the vectors.
> >
> >
> >      res <- c( "Y",  "H", NA,  "B" )
> >
> >
> > Thanks,
> >
> > Patricia
> >
> 
> -- 
> Gabor Csardi <Gabor.Csardi@unil.ch>     UNIL DGM

_________________________________________________________________


	[[alternative HTML version deleted]]


