Dear list members,
I am using function cbind but I got 2 different results, one is a data
frame and the other is a matrix and I would like to undertand why is the
reason:
I have a data frame called "finaldf"
> names(finaldf)
[1] "especie" "estrato" "oc1" "oc2" "oc3" "oc4" "oc5"
"oc6"
[9] "oc7" "oc8" "oc9" "oc10" "oc11" "oc12" "oc13"
"oc14"
[17] "oc15" "oc16" "oc17" "oc18" "oc19" "oc20"
I tried (gave me a data frame):
DET <- cbind(finaldf[, 3:22])
> head(DET)
oc1 oc2 oc3 oc4 oc5 oc6 oc7 oc8 oc9 oc10 oc11 oc12 oc13 oc14 oc15 oc16
oc17 oc18
1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0
27 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1
0 0
53 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0
2 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1
1 1
28 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1
1 0
54 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 0
0 0
oc19 oc20
1 0 0
27 1 0
53 0 0
2 1 1
28 1 0
54 0 1
and gave me a different results when I tried (gave me a matrix):
DET <- cbind(finaldf$oc1, finaldf$oc2, finaldf$oc3, finaldf$oc4,
finaldf$oc5, finaldf$oc6, finaldf$oc7, finaldf$oc8, finaldf$oc9,
finaldf$oc10, finaldf$oc11, finaldf$oc12, finaldf$oc13, finaldf$oc14,
finaldf$oc15, finaldf$oc16, finaldf$oc17, finaldf$oc18, finaldf$oc19,
finaldf$oc20)
> head(DET)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[,14]
[1,] 0 0 0 0 0 0 0 0 1 0 0 0 0
0
[2,] 0 0 0 1 0 0 0 0 0 0 0 0 0
0
[3,] 0 0 0 0 0 0 0 0 0 0 0 0 0
0
[4,] 1 1 1 1 1 1 0 1 1 1 1 1 0
1
[5,] 1 0 1 0 1 1 1 1 1 1 1 1 0
1
[6,] 1 1 1 1 1 1 1 1 0 0 0 1 1
0
[,15] [,16] [,17] [,18] [,19] [,20]
[1,] 0 0 0 0 0 0
[2,] 0 1 0 0 1 0
[3,] 0 0 0 0 0 0
[4,] 0 1 1 1 1 1
[5,] 1 1 1 0 1 0
[6,] 1 0 0 0 0 1
Best,
Manuel
--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[email protected]
[email protected]
Teléfono: (506) 2277-3598
Fax: (506) 2237-7036
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
[[alternative HTML version deleted]]
_______________________________________________
R-sig-ecology mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology