From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Tue Nov 11 20:58:56 2008
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Tue, 11 Nov 2008 20:58:56 +0100
Subject: [Rd] is.matrix
In-Reply-To: <f8e6ff050811111148m773ec9d3x22cbabd8efa8b51c@mail.gmail.com>
References: <d8858f220811111020j233d4d98j502c0079ace644e7@mail.gmail.com>	
	<4919D240.4040904@acm.org>	
	<f8e6ff050811111121u62cc1329s605ca0dcd521dfb2@mail.gmail.com>	
	<4919E010.8080603@idi.ntnu.no>
	<f8e6ff050811111148m773ec9d3x22cbabd8efa8b51c@mail.gmail.com>
Message-ID: <4919E400.9090707@idi.ntnu.no>

hadley wickham wrote:
> On Tue, Nov 11, 2008 at 1:42 PM, Wacek Kusnierczyk
> <Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
>   
>> hadley wickham wrote:
>>     
>>>> |  is.matrix| returns |TRUE| if |x| is a matrix and has a |dim <dim.html>|
>>>> attribute of length 2) and |FALSE| otherwise
>>>>
>>>>         
>>> That's confusing!  In what situations is x a matrix but does not have
>>> a dim attribute?
>>>
>>>
>>>       
>> x = matrix(1,1,1)
>> dim(x) = c(1,1,1)
>>     
>
> I think you meant
> dim(x) <- c(3, 1)
>
> You created a 1 x 1 x 1 array.
>   

i know, that's precisely what i wanted.  this is a simple 3d structure,
yet is(x) reveals it is a matrix.  that was the point.

some further observations:

x = as.list(1:2)
is(x)
# x is a list

dim(x) = 2
is.list(x)
# sure
is(x)
# not so sure any more -- a matrix?

vQ



[Rd] is.matrix
Wacek Kusnierczyk