Re: [R] as.matrix strangeness

2011-04-15 Thread Ista Zahn
Hi Michael, It helps to look at the "Usage" section of the help pages. There you will see that matrix() has an ncol argument, but as.matrix() does not. Best, Ista On Fri, Apr 15, 2011 at 7:08 AM, Michael Bach wrote: > Hi Adrian, > > thanks for the hint.  The problem was that it showed me help fo

Re: [R] as.matrix strangeness

2011-04-15 Thread Michael Bach
Hi Adrian, thanks for the hint. The problem was that it showed me help for matrix when I did ?as.matrix. I thought it was some kind of convention that data type conversion functions start with "as.", so now I will take more care in the future. With matrix() it works as expected, thanks again.

Re: [R] as.matrix strangeness

2011-04-15 Thread Adrian Duffner
Hallo Michael, check ?matrix and compare to as.matrix. as.matrix does not provide a ncol argument. To get a 2 by 2 matrix use matrix(a, ncol=2) Regards Adrian Am 15.04.2011 11:42, schrieb Michael Bach: Dear R users, I presume there is something foul with system: a<- c(1,2,3,4) as.matrix(a,

[R] as.matrix strangeness

2011-04-15 Thread Michael Bach
Dear R users, I presume there is something foul with system: a <- c(1,2,3,4) as.matrix(a, ncol=2) Output: [,1] [1,]1 [2,]2 [3,]3 [4,]4 The vignette for as.matrix says nrow (ncol) will be deduced from length and ncol (nrow). It does not work even when I additionally specif