Re: [R] cbind() function : Not able to display columns

2013-10-22 Thread Richard M. Heiberger
In addition to what the others have told you, it looks like you might be confusing matrices with data.frames. Please see ?data.frame I think what you are looking for is > b <- c('a','b','c') > c <- c("ee","tt","rr") > k <- cbind(a,b,c) > K <- data.frame(a, b, c) > K a b c 1 1 a ee 2 2 b tt 3

Re: [R] cbind() function : Not able to display columns

2013-10-22 Thread Jeff Newmiller
Hard to say, not sure what you want to do. But the columns are not denoted by [a], [b] or [c]. You should learn to use the str function to understand what various expressions really are, and return to the "Introduction to R" document that comes with the software. There is a distinct difference b

Re: [R] cbind() function : Not able to display columns

2013-10-22 Thread arun
Hi, Try:   k[,"a"] #[1] "1" "2" "3"  k[,"b"] #[1] "a" "b" "c"  k[,"c"] #[1] "ee" "tt" "rr" A.K. On Tuesday, October 22, 2013 11:37 PM, Vivek Singh wrote: 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=cbi

[R] cbind() function : Not able to display columns

2013-10-22 Thread Vivek Singh
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