Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-18 Thread Worik R
[snip] sapply.  In this case I would expect M to be a list.  I am gobsmacked that a list can be considered a vector.    Is that a bug?  It must be bad design? I have been using R for a number of years (5?) and heavilly for two years. I am still getting bitten by these features in R.  To

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-18 Thread William Dunlap
-Original Message- From: Worik R [mailto:wor...@gmail.com] Sent: Wednesday, April 18, 2012 5:05 PM To: William Dunlap Cc: r-help Subject: Re: [R] Can a matrix have 'list' as rows/columns? [snip] sapply.  In this case I would expect M to be a list.  I am gobsmacked

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-18 Thread Worik R
Message- From: Worik R [mailto:wor...@gmail.com] Sent: Wednesday, April 18, 2012 5:05 PM To: William Dunlap Cc: r-help Subject: Re: [R] Can a matrix have 'list' as rows/columns? [snip] sapply.  In this case I would expect M to be a list.  I am gobsmacked that a list can be considered

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread Patrick Burns
That is a fine section of 'The R Inferno' but I don't think it applies to your problem. The answer to your question in the subject line is obviously yes. It happens when the matrix (or more generally any array) is of mode list. A useful example of this is in Circle 8.1.8.

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread David Winsemius
On Apr 17, 2012, at 12:13 AM, Worik R wrote: After a lot of processing I get a matrix into M. I expected each row and column to be a vector. But it is a list. This behavior is not the result of limitation in how R's sapply might have processed a purely numeric set of results, but is

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread Worik R
On Tue, Apr 17, 2012 at 11:52 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 17, 2012, at 12:13 AM, Worik R wrote: After a lot of processing I get a matrix into M. I expected each row and column to be a vector. But it is a list. This behavior is not the result of limitation in

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread David Winsemius
On Apr 17, 2012, at 7:27 PM, Worik R wrote: On Tue, Apr 17, 2012 at 11:52 PM, David Winsemius dwinsem...@comcast.net wrote: On Apr 17, 2012, at 12:13 AM, Worik R wrote: After a lot of processing I get a matrix into M. I expected each row and column to be a vector. But it is a list.

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread William Dunlap
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Worik R Sent: Tuesday, April 17, 2012 4:28 PM To: r-help Subject: Re: [R] Can a matrix have 'list' as rows/columns? On Tue, Apr 17, 2012 at 11:52 PM, David Winsemius dwinsem...@comcast.netwrote

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-17 Thread Bert Gunter
Not sure this adds to, subtracts from, or obfuscates this thread, but ... x - list(a=1:3,b = log, c=letters[2],d=as.list(1:5)) is.vector(x) [1] TRUE dim(x) - c(2,2) is.matrix(x) [1] TRUE is.vector(x) [1] FALSE x [,1] [,2] [1,] Integer,3 b [2,] ? List,5 x[2,1](5)

[R] Can a matrix have 'list' as rows/columns?

2012-04-16 Thread Worik R
After a lot of processing I get a matrix into M. I expected each row and column to be a vector. But it is a list. R-Inferno says... Arrays (including matrices) can be subscripted with a matrix of positive numbers. The subscripting matrix has as many columns as there are dimensions in the

Re: [R] Can a matrix have 'list' as rows/columns?

2012-04-16 Thread Henrik Bengtsson
On Mon, Apr 16, 2012 at 9:13 PM, Worik R wor...@gmail.com wrote: After a lot of processing I get a matrix into M.  I expected each row and column to be a vector.  But it is a list. Lists are also vectors, e.g. x - list() is.vector(x) [1] TRUE y - vector(list, length=3) str(y) List of 3 $