Hi All,
I have create a matrix using cbind() function as follows:
> a=c(1,2,3)
> b=c('a','b','c')
> c=c("ee","tt","rr")
> k=cbind(a,b,c)
Problem: when we print the matrix k,
> k
a b c
[1,] "1" "a" "ee"
[2,] "2" "b" "tt"
[3,] "3" "c" "rr"
we can see that rows are represented by [1,] , [2,] and [3,]. Similarly,
the columns are denoted by [a], [b] and [c]. When we try to print the
corresponding columns, we are able to print for k[a], i.e., the first
column but not able to correctly print the second and third columns.
> k[a]
[1] "1" "2" "3"
> k[b]
[1] NA NA NA
> k[c]
[1] NA NA NA
Please let me know what am I doing wrong.
--
Thanks and Regards,
Vivek Kumar Singh
Research Assistant,
School of Computing,
National University of Singapore
Mobile:(0065) 82721535
[[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.