[R] problem when extacting columns of a data frame in a new data frame

Dieter Menne dieter.menne at menne-biomed.de
Tue Jan 8 09:50:55 CET 2008


Delphine Fontaine <delphine.fontaine <at> genexion.com> writes:

> I would like to create a new data frame composed of 2 columns of another
> data frame. But it does not give me what I want...
> 
> > casesCNST[1:10,]
>    case X1 X2 X3 X4 expected
> 1    A1  0  0  0  0        E
> 2    A2  0  0  0  1        C
...
 
> > expectedCNST <- data.frame (cbind (casesCNST$case, casesCNST$expected))
> 
> > expectedCNST[1:10,]
>     X1 X2
> 1    1  4
......


attenu[1:10,]
attenu[1:10,c("mag","dist")]

Dieter




More information about the R-help mailing list