Skip to content
Back to formatted view

Raw Message

Message-ID: <4da812f5.06f0d80a.63a9.7d01@mx.google.com>
Date: 2011-04-15T09:42:10Z
From: Michael Bach
Subject: as.matrix strangeness

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 specify
nrow=2.  It behaves as if I had not given the ncol argument.  Any hints
on what might be borked up here?

R.Version()$ver
[1] "R version 2.10.1 (2009-12-14)"

Thanks in advance,
Michael Bach