[R] dimnames

David Winsemius dwinsemius at comcast.net
Wed Aug 18 19:43:26 CEST 2010


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



More information about the R-help mailing list