Guest User

Untitled

a guest
Apr 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. Select x.X1, x.X2, y.X3
  2. into z
  3. from x inner join y on x.X1 = y.X1
  4.  
  5. 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))
  6. y<-data.frame(cbind('X1'=c(9,5,8,2),'X3'=c('nine','five','eight','two')))
  7.  
  8. 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])
  9.  
  10. library(sqldf)
  11. z <- sqldf("SELECT X1, X2, X3 FROM x JOIN y
  12. USING(X1)")
Add Comment
Please, Sign In to add comment