If I understand the question correctly, I would do this:

for (i in 1:54)   assign(  paste('input',i,sep='') ,  matrix( 
dataset$variable, nrow=1)   )


You now have 54 matrices, named input1, input2, ... input54, each 
having 1 row and as many columns as dataset$variable is long.
(also, they're identical, since all are created from the same object, 
dataset$variable)

See,  of course, the help page for assign() to see why this works.

However, I do wonder, in the bigger picture of what you're trying to 
do, whether there isn't a better way. For example, why matrices, 
since they all have only one row?

-Don

At 5:02 PM +0100 2/25/07, Monika Kerekes wrote:
>Dear members,
>
>
>
>I have started to work with R recently and there is one thing which I could
>not solve so far. I don't know how to define macros in R. The problem at
>hand is the following: I want R to go through a list of 1:54 and create the
>matrices input1, input2, input3 up to input54. I have tried the following:
>
>
>
>for ( i in 1:54) {
>
>       input[i] = matrix(nrow = 1, ncol = 107)
>
>       input[i][1,]=datset$variable
>
>}
>
>
>
>However, R never creates the required matrices. I have also tried to type
>input'i' and input$i, none of which worked. I would be very grateful for
>help as this is a basic question the answer of which is paramount to any
>further usage of the software.
>
>
>
>Thank you very much
>
>
>
>Monika
>
>
>
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.


-- 
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to