> x <- data.frame( 1:10, runif(10) )
> y <- data.frame( 6:10, runif(5) )
> merge(x, y, by=1, all=TRUE)
X1.10 runif.10. runif.5.
1 1 0.4915303 NA
2 2 0.7108826 NA
3 3 0.5658456 NA
4 4 0.4201561 NA
5 5 0.9575464 NA
6 6 0.1650210 0.82674151
7 7 0.2198187 0.24383035
8 8 0.4571945 0.01177674
9 9 0.9026321 0.76861464
10 10 0.1046505 0.23990883
On Fri, 2004-07-23 at 16:07, Bruno Cutayar wrote:
> Hi,
> i have two data.frame x and y like :
> > x <- data.frame( num = c(1:10), value = runif(10) )
> > y <- data.frame( num = c(6:10), value = runif(5) )
> and i want to obtain something like :
>
> num.x value.x num.y value.y
> 1 0.38423828 NA 0.2911089
> 2 0.17402507 NA 0.8455208
> 3 0.54443465 NA 0.8782199
> 4 0.04540406 NA 0.3202252
> 5 0.46052426 NA 0.7560559
> 6 0.61385464 6 0.2911089
> 7 0.48274968 7 0.8455208
> 8 0.11961778 8 0.8782199
> 9 0.64531394 9 0.3202252
> 10 0.92052805 10 0.7560559
>
> with NA in case of missing value for y to x.
>
> { for this example : i write simply
> > data.frame(num.x=c(1:10),
> value.x=x[[2]],num.y=c(rep(NA,5),6:10),value.y=y[[2]]) }
>
> I didn't find solution in merge(x,y,by="num") : missing rows are no keeping.
> Can't you help me ?
>
> thanks,
> Bruno
>
>
>
> Si vous n'etes pas destinataires de ce message, merci d'avertir l'expediteur de
> l'erreur de distribution et de le detruire immediatement.
> Ce message contient des informations confidentielles ou appartenant a La Francaise
> des Jeux. Il est etabli a l'intention exclusive de ses destinataires. Toute
> divulgation, utilisation, diffusion ou reproduction (totale ou partielle) de ce
> message ou des informations qu'il contient, doit etre prealablement autorisee.
> Tout message electronique est susceptible d'alteration et son integrite ne peut etre
> assuree. La Francaise des Jeux decline toute responsabilite au titre de ce message
> s'il a ete modifie ou falsifie.
>
> If you are not the intended recipient of this e-mail, please notify the sender of
> the wrong delivery and delete it immediately from your system.
> This e-mail contains confidential information or information belonging to La
> Francaise des Jeux and is intended solely for the addressees. The unauthorised
> disclosure, use, dissemination or copying (either whole or partial) of this e-mail,
> or any information it contains, is prohibited.
> E-mails are susceptible to alteration and their integrity cannot be guaranteed. La
> Francaise des Jeux shall not be liable for this e-mail if modified or falsified.
>
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html