[R] data management on R
Jim Lemon
bitwrit at ozemail.com.au
Sat Mar 25 04:36:44 CET 2006
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
More information about the R-help
mailing list