Hi,
Here are two options. Depending whether the data is already read in
or being created, one or the other may be more useful to you
###########
x1 <- matrix(1:4, ncol = 2)
colnames(x1) <- c("First", "Second")
#OR
x2 <- matrix(1:4, ncol = 2, dimnames = list(NULL, c("First",
"Second")))
x1
x2
#########
Cheers,
Josh
On Tue, Aug 17, 2010 at 6:08 PM, R Newbie <help0938450 at gmail.com>
wrote:> Does anyone know how to assign (column names only) to a matrix?
>
> ______________________________________________
> R-help at r-project.org 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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/