On Oct 11, 2011, at 4:22 PM, Bert Gunter wrote:
Replicate the row indices?
x[rep(seq_len(nrow(x)), k), ]
Or the column indices.
x[ , rep(seq_len(length(x)), k) ]
--
David,
-- Bert
On Tue, Oct 11, 2011 at 12:55 PM, Martin Batholdy
<batho...@googlemail.com>wrote:
Hi,
is there a way to replicate a data.frame like you can replicate the
entries
of a vector (with the repeat-function)?
I want to do this:
x <- data.frame(x, x)
(where x is a data.frame).
but n times.
And it should be as cpu / memory efficient as possible, since n is
pretty
big in my case.
thanks for any suggestions!
______________________________________________
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.
--
"Men by nature long to get on to the ultimate truths, and will often
be
impatient with elementary studies or fight shy of them. If it were
possible
to reach the ultimate truths without the elementary studies usually
prefixed
to them, these would not be preparatory studies but superfluous
diversions."
-- Maimonides (1135-1204)
Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
[[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.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.