hi,
when I used cbind to combine columns, some contents of columns has been
replaced by
number. in the script below, column should be aaa,bbb,ccc but I was given 1,2,3.
but when I change the column to vector, it gave me correct contents. can you
please
tell me why?
> d<-read.table("aaa.txt")
> d
V1 V2
1 aaa 123
2 bbb 345
3 ccc 986
> cbind(d[,1],d[,2])
[,1] [,2]
[1,] 1 123
[2,] 2 345
[3,] 3 986
> cbind(as.vector(d[,1]),d[,2])
[,1] [,2]
[1,] "aaa" "123"
[2,] "bbb" "345"
[3,] "ccc" "986"
>
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.