Re: [R] Loop problem

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Mon, 14 Jul 2008 08:25:14 -0400

Try this:

pk[rep(1, 4), ]

On Mon, Jul 14, 2008 at 4:33 AM, fernanda lopez <lopezfer123_at_gmail.com> wrote:
> Dear all,
> I want to
> write ck<-cbind(rep(pk[1,1],4),rep(pk[1,2],4),rep(pk[1,3],4)) state ment
> in a loop . How can I write it ?
>
>
>
>
>
>> pk
> [,1] [,2] [,3]
> [1,] -1.1354816 0.9808877 -0.9446314
> [2,] 0.7787378 0.4536944 0.3204882
> [3,] -1.7274907 1.5112011 1.4481839
> [4,] 1.0629145 0.5976109 -0.5277638
>
>
>
>> pk<-matrix(rnorm(12),nrow=4,ncol=3)
>> pk
> [,1] [,2] [,3]
> [1,] -1.1354816 0.9808877 -0.9446314
> [2,] 0.7787378 0.4536944 0.3204882
> [3,] -1.7274907 1.5112011 1.4481839
> [4,] 1.0629145 0.5976109 -0.5277638
>
>> ck<-cbind(rep(pk[1,1],4),rep(pk[1,2],4),rep(pk[1,3],4))
>> ck
> [,1] [,2] [,3]
> [1,] -1.135482 0.9808877 -0.9446314
> [2,] -1.135482 0.9808877 -0.9446314
> [3,] -1.135482 0.9808877 -0.9446314
> [4,] -1.135482 0.9808877 -0.9446314
>
>
> Thanks for your help
>
> Fernanda Lopez
> Netherlands
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_r-project.org 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.
>



R-help_at_r-project.org 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. Received on Mon 14 Jul 2008 - 12:39:43 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Jul 2008 - 13:31:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive