[R] Newbie help on dim

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Sep 1 14:31:32 CEST 2005


Chuck Cleland wrote:

> Should the Value: section of the help page read:
> 
> For an array (and hence in particular, for a matrix) dim retrieves the
> dim attribute of the object. It is NULL for a vector of mode integer.
> 
> NOTE: for not or in the second sentence.

NO!!! The help page is correct!

The *value* is either NULL *or* a vector of mode integer.
It is always NULL for any vector without dim attribute (also for 
character vectors!):

  x <- "a"
  dim(x) # NULL
  dim(x) <- 1
  dim(x) # 1

Uwe Ligges




> Uwe Ligges wrote:
> 
>> Christian Prinoth wrote:
>>
>>
>>> Hi, if I do
>>>
>>> Z<-rnorm(50)
>>> Followed by
>>> Dim(Z)
>>> I get NULL. Is this correct? Shouldn't I get 50 instead?
>>
>>
>>
>>
>> No, because Z has no dim attribute. ?dim tells you:
>>
>> "For an array (and hence in particular, for a matrix) dim retrieves 
>> the dim attribute of the object. It is NULL or a vector of mode integer."
>>
>>
>>> TIA
>>> Chris
>>>
>>> DISCLAIMER:\ L'utilizzo non autorizzato del presente 
>>> messagg...{{dropped}}
>>>
>>> ______________________________________________
>>> R-help at stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide! 
>>> http://www.R-project.org/posting-guide.html
>>
>>
>>
>> Yes, PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>>
>>
>> Uwe Ligges
>>
>> ______________________________________________
>> R-help at stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide! 
>> http://www.R-project.org/posting-guide.html
>>
>>
>




More information about the R-help mailing list