[R] Combining Dataframes
Bert Jacobs
b.jacobs at pandora.be
Sun Feb 25 17:27:25 CET 2007
Hi,
What is the best way to combine several dataframes (approx a dozen, all
having one column) into one? All dataframes have a different rowlength, and
do not contain numbers.
As this new dataframe should have the length of the dataframe with the most
rows, the difference in rows with the other dataframes can be filled with
the value NA.
I've tried merge (only possible with 2 df) and cbind (gives error)
Thx for helping me out.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Alberto Vieira
Ferreira Monteiro
Sent: 25 February 2007 16:52
To: r-help at stat.math.ethz.ch
Subject: Re: [R] Random Integers
Charles Annis, P.E. wrote:
>
> rpois(n, lambda)
>
> ... will do it. But you should tell us something about how you want your
> numbers to be distributed, since rpois() produces integers having a
Poisson
> distribution.
>
<nitpick>
rpois does not generate random _integers_, it generates random
_natural numbers_.
</nitpick>
The question should be more descriptive. "Random" is half of the things
we need to know, the other half is how deterministic you want your integers.
For example, if you want to generate random integers in such a way that
all integers have the same probability, then this can't be done. OTOH, if
you want to simulate random integers that distribute "like integers appear
in Nature", then it's still not precise, but there are serious attempts
to reproduce this behaviour. Check in the wikipedia (www.wikipedia.org)
those distributions: Zip's law, Zeta distribution, Benford's law,
Zipf-Mandelbrot law. The problem is that all of them generate positive
random integers, but it's not difficult to extrapolate them to integers.
Alberto Monteiro
______________________________________________
R-help at 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.
More information about the R-help
mailing list