Skip to content
Back to formatted view

Raw Message

Message-ID: <40FC171B-2666-408F-8BD8-C0A6D86D5C45@comcast.net>
Date: 2009-03-13T21:18:24Z
From: David Winsemius
Subject: transforming a matrix
In-Reply-To: <b6150c70903131256q5c5fa4aao17bc974bf1d7532a@mail.gmail.com>

Am I correct in thinking that you actually want a function that will  
take the three row matrix

Ystart <- matrix(c(1:3, 34,-56,27), ncol=2) and return the 4 column  
matrix offered?

As it is I see no way that we could know what rule you wanted to apply  
to that four row X matrix to get the 9 row Y matrix. I suppose this  
could be one of those intelligence test questions that I won't get  
right and thereby fail my entrance exams.

-- 
David Winsemius
On Mar 13, 2009, at 3:56 PM, Dimitri Szerman wrote:

> Hello,
> I have a matrix such as
>
>> X = matrix(c(1:4,29,32,56,-45), ncol=2)
>
> and I want one like
>
>> Y=matrix(c(
> 1 , 34 , 1 , 34 ,
> 2 , -56 , 1 , 34 ,
> 3 , 27 , 1 , 34 ,
> 1 , 34 , 2 , -56 ,
> 2 , -56 , 2 , -56 ,
> 3 , 27 , 2 , -56 ,
> 1 , 34 , 3 , 27 ,
> 2 , -56 , 3 , 27 ,
> 3 , 27 , 3 , 27 ), ncol=4, byrow=T)
>
> How do I do this in an efficient and elegant way?
>
>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT