[R] data management on R
Jacques VESLOT
jacques.veslot at cirad.fr
Fri Mar 24 11:58:12 CET 2006
if A, B and C are of matrix class:
C <- cbind(x=A[, 1], n=B[, 2])
if A, B and C are of data.frame class:
C <- cbind.data.frame(x=A$x, n=B$n)
C <- data.frame(x=A$x, n=B$n)
linda.s a écrit :
>what is the difference between the two matrix B and C?
>
>
>>B
>>
>>
> m n
>1 1 2
>2 7 8
>
>
>>C <- cbind(x=A[, 1], n=B[, 2])
>>C
>>
>>
> x n
>[1,] 1 2
>[2,] 3 8
>
>For B, it use 1 and 2 to indicate rows while C use[1,] and [2,]
>
>On 3/23/06, Jacques VESLOT <jacques.veslot at cirad.fr> wrote:
>
>
>>C <- cbind(x=A[, 1], n=B[, 2])
>>
>>
>>
>>
>>
>
>
>
More information about the R-help
mailing list