zhijie zhang wrote: > Dear friends, > i have two dataset: A and B > A: > x y > 1 2 > 3 4 > > B: > m n > 1 2 > 7 8 > > How to generate datasetC: > C: > x n > 1 2 > 3 8 > i know sas can do it easily, what about R? > A<-data.frame(x=c(1,3),y=c(2,4)) B<-data.frame(m=c(1,7),n=c(2,8)) C<-data.frame(A[1],B[2])
Using single square brackets extracts just the named vectors. Jim ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
