Dear all,
Here is one more way to go though using rep() and then matrix():
> rows <- 1:3
> matrix(rep(rows,5),ncol=5)
[,1] [,2] [,3] [,4] [,5]
[1,]11111
[2,]22222
[3,]33333
HTH,
Jorge
On Tue, Feb 24, 2009 at 1:43 PM, Gabor Grothe
Suppose we want 3 rows and the ith row should have 5 columns of i.
Create a list whose ith component is the ith row and rbind them:
> rows <- 1:3
> do.call(rbind, lapply(rows, rep, 5))
[,1] [,2] [,3] [,4] [,5]
[1,]11111
[2,]22222
[3,]333
ical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Alexy Khrabrov
> Sent: Tuesday, February 24, 2009 11:02 AM
> To: r-h...@stat.math.ethz.ch
> Su
I'm growing a large dataframe by composing new rows and then doing
row <- compute.new.row.somehow(...)
d <- rbind(d,row)
Is this a fast/preferred way?
Cheers,
Alexy
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEA
4 matches
Mail list logo