library(plyr)
colnames(Y)[2]<- colnames(X)
join(X,Y,type="left",by="k1")
# k1 k2
#1 A 1
#2 NA
#3 C 3
#4 B 2
A.K.
- Original Message -
From: nevil amos
To: r-help
Cc:
Sent: Friday, May 31, 2013 4:07 AM
Subject: [R] merge without NA last
I am t
Le vendredi 31 mai 2013 à 18:07 +1000, nevil amos a écrit :
> I am trying to create a merge where the first value contains NA values. I
> wish to retain these in order. however when I use all.x=T and sort=F they
> are retained but na values are placed last:
>
> > X<-data.frame(k1=c("A",NA,"C","B
I am trying to create a merge where the first value contains NA values. I
wish to retain these in order. however when I use all.x=T and sort=F they
are retained but na values are placed last:
> X<-data.frame(k1=c("A",NA,"C","B"))
> print (X)
k1
1A
2
3C
4B
> Y<-data.frame(k2=c(1,
3 matches
Mail list logo