Skip to content

Understanding cbind

4 messages · Manuel Spínola, Phil Novack-Gottshall, Mario José Marques

#
Hi Manuel,

when you use cbind(finaldf[, 3:22], cbind function waiting that you gave 
second data to bind with first. How you use only one data, its result like:

DEV <- finaldf[, 3:22]

with the same structure of data frame finaldf.

When you use cbind(finaldf$oc1, finaldf$oc2,... you bind a vector of 
number into columns. Its like:

v1 <- 0,0,0,1,1,1
v2 <- 1,1,1,0,0,0
...

cbind(v1, v2, ...)

that result:

       [ ,1] [ ,1]
[1, ] 0     1
[2, ] 0     1
[3, ] 0     1
[4, ] 1     0
[5, ] 1     0
[6, ] 1     0

Regards,

MJ
...................................................
Mario Jos? Marques
Master student in Ecology
Institute of Biology, Dept. Plant Biology, Ecology Lab.
State University of Campinas - UNICAMP
Campinas, S?o Paulo, Brazil
On 20/07/2012 13:13, Manuel Sp?nola wrote:
1 day later