On Aug 18, 2010, at 12:38 PM, David Winsemius wrote:


On Aug 18, 2010, at 11:58 AM, Jimmy Söderly wrote:

Hi everybody,

I wanted to name a column vector (a variable).

This is what I did :

try<-matrix(1:4,nrow=4,ncol=1)

("try" is a bad name for an object because it is a useful function name.)

attr(try,"dimnames")<-list(NULL,"true value")

Is it OK ?

Single column matrices get automatically converted to vectors unless you use drop=FALSE.

The above sentence actually only a problem when you access single column vectors with "[", so wouldn't really apply to this question. Sorry for that misdirection on that point. The other comments still hold.


Furthermore naming vectors with strings that contain spaces is possible but unwise , because you will forever be needing to stick quotes around what would otherwise not need the quotes



Thanks for your help,
Jimmy


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@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.

Reply via email to