Try this: m[rep(seq_len(nrow(m)), 3),]
On Wed, Jan 7, 2009 at 1:22 PM, Niccolò Bassani <biostatist...@gmail.com>wrote: > Dear R users,I'm facing a trivial problem, but I really can't solve it. > I've > tried a dozen of codes, but I can't get the result I want. > The question is: I have a dataframe like this one > > [,1] [,2] [,3] [,4] [,5] > [1,] 1 2 3 4 5 > [2,] 2 5 5 4 9 > [3,] 1 6 8 1 2 > [4,] 8 6 4 1 5 > > made up of decimal numbers, of course. > I want to append this dataframe to itself a number x of times, i.e. 3. That > is I want a dataframe like this > > > [,1] [,2] [,3] [,4] [,5] > [1,] 1 2 3 4 5 > [2,] 2 5 5 4 9 > [3,] 1 6 8 1 2 > [4,] 8 6 4 1 5 > [5,] 1 2 3 4 5 > [6,] 2 5 5 4 9 > [7,] 1 6 8 1 2 > [8,] 8 6 4 1 5 > [9,] 1 2 3 4 5 > [10,] 2 5 5 4 9 > [11,] 1 6 8 1 2 > [12,] 8 6 4 1 5 > > I'm searching for an "authomatic" way to do this (I've already used the > rbind re-writing x times the name of the frame...), as it must enter a > function where one argument is exactly the number x of times to repeat this > frame. > > Any ideas?? > Thanks in advance! > > Niccolò > > [[alternative HTML version deleted]] > > > ______________________________________________ > R-help@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. > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@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.