Rolf Turner wrote:
>
> On 16/02/2009, at 8:36 AM, Roger wrote:
>
>> This is supposed to be an easy operation, but R 2.8.1 on Mac OS X
>> gives me a
>> lot trouble. the t() function simply does not work properly. What I
>> mean is
>> it works sometimes but does not work at the most of the time, eve
Here's one way that seems to work:
a <- matrix(1:30,5,6)
# Create a target for the transpose
b <- matrix(1:(nrow(a)*ncol(a)),ncol(a),nrow(a))
# populate b with the transpose of a
for (i in 1:ncol(a)) { b[i,1:(nrow(a))] <- a[1:(nrow(a)),i]}
# Check: Did it work?
all.equal(b,t(a))
I'm sure there's
Roger wrote:
> This is supposed to be an easy operation, but R 2.8.1 on Mac OS X gives me a
> lot trouble. the t() function simply does not work properly. What I mean is
> it works sometimes but does not work at the most of the time, even with the
> same matrix.
>
> this is an example taken from R
On 16/02/2009, at 8:36 AM, Roger wrote:
This is supposed to be an easy operation, but R 2.8.1 on Mac OS X
gives me a
lot trouble. the t() function simply does not work properly. What
I mean is
it works sometimes but does not work at the most of the time, even
with the
same matrix.
this
This is supposed to be an easy operation, but R 2.8.1 on Mac OS X gives me a
lot trouble. the t() function simply does not work properly. What I mean is
it works sometimes but does not work at the most of the time, even with the
same matrix.
this is an example taken from R help
> a <- matrix(1:3
5 matches
Mail list logo