Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Select x.X1, x.X2, y.X3
- into z
- from x inner join y on x.X1 = y.X1
- x<-data.frame(cbind('X1'=c(5,9,7,6,4,8,3,1,10,2),'X2'=c(5,9,7,6,4,8,3,1,10,2)^2))
- y<-data.frame(cbind('X1'=c(9,5,8,2),'X3'=c('nine','five','eight','two')))
- z<-cbind(x[which(x$X1 %in% (y$X1)), c(1:2)][order(x[which(x$X1 %in% (y$X1)), c(1:2)]$X1),],y[order(y$X1),2])
- library(sqldf)
- z <- sqldf("SELECT X1, X2, X3 FROM x JOIN y
- USING(X1)")
Add Comment
Please, Sign In to add comment