On Wed, 17 Jan 2007, Patrick Burns wrote:
A logical reason for the phenomenon is that
matrices are stored down their columns. For
example:
matrix(1:15,5)
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
When an
On 18 Jan 2007, at 08:42, Prof Brian Ripley wrote:
On Wed, 17 Jan 2007, Patrick Burns wrote:
A logical reason for the phenomenon is that
matrices are stored down their columns. For
example:
[snip]
Or that the vision of the original designer was not limited to
matrices.
It just so
Thanks to all for your insightful comments. I must admit I was unaware
of the application to arrays.
Ben
Prof Brian Ripley wrote:
Or that the vision of the original designer was not limited to
matrices. It just so happens that in this example the replacement is a
single dimension the same
A logical reason for the phenomenon is that
matrices are stored down their columns. For
example:
matrix(1:15,5)
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
When an 'apply' across rows is done, it will be
the values
2007/1/17, Patrick Burns [EMAIL PROTECTED]:
A logical reason for the phenomenon is that
matrices are stored down their columns. For
example:
matrix(1:15,5)
[,1] [,2] [,3]
[1,]16 11
[2,]27 12
[3,]38 13
[4,]49 14
[5,]5 10 15
When an
Reading the documentation for 'apply', I understand the following is
working exactly as documented:
M-matrix(1:6,ncol=2)
M
[,1] [,2]
[1,]14
[2,]25
[3,]36
apply(M,2,function(column) column+c(1,2,3))
[,1] [,2]
[1,]25
[2,]47
[3,]69
The reshape package has an idempotent apply, iapply:
library(reshape)
iapply(M,1,function(row) row+c(1,2))
[,1] [,2]
[1,]26
[2,]37
[3,]48
On 1/16/07, Benjamin Tyner [EMAIL PROTECTED] wrote:
Reading the documentation for 'apply', I understand the following is