Skip to content

Help with merge function

1 message · arun

#
Hi,

Check whether this works.

Lines1<-readLines("NS_update.txt")
x1<-read.table(text=gsub('\"',"",Lines1),sep=",",header=TRUE,stringsAsFactors=FALSE)
?x2<- read.table("data.txt",sep="",header=TRUE,stringsAsFactors=FALSE,fill=TRUE)
?dim(x2)
#[1] 34577?? 189
library(plyr) 
?res<- join(x1,x2,type="right")
#Joining by: State_Prov, Shape_name, bob2009, bob2010, red2009, red2010, coy2009, coy2010, lyn2009, lyn2010
?dim(res)
#[1] 34577?? 193

?res2<- merge(x1,x2,all.y=TRUE)
?dim(res2)
#[1] 34577?? 193
A.K.