[R] Combining simulated data
Schalk Heunis
schalk.heunis at enerweb.co.za
Wed Sep 9 21:45:03 CEST 2009
Kabeli
I think this is what you want:
Hypermarket <- matrix(rnorm(10, mean=20000, sd=7000))
Supermarket <- matrix(rnorm(15, mean=12000, sd=4000))
Minimarket <- matrix(rnorm(20, mean=10000, sd=4000))
Cornershop <- matrix(rnorm(20, mean= 8000, sd=3000))
Spazashop <- matrix(rnorm(35, mean= 7000, sd=3000))
rbind(Hypermarket,Supermarket,Minimarket,Cornershop,Spazashop)
This creates a matrix with one column and 100 rows. You can add names
also by doing something like this for e.g. Spazashop
Spazashop <- matrix(rnorm(35, mean= 7000, sd=3000), dimnames =
list(paste("Spazashop",1:35)))
Hope this helps.
Schalk Heunis
On Wed, Sep 9, 2009 at 2:26 AM, KABELI MEFANE<kabelimefane at yahoo.co.uk> wrote:
> R helpers
>
> Please help me combine the simulated data to a form of table where: Hypermarket have 10 rows, supermarket have 15 rows,......., spazashops with 35 rows.
>
> Hypermarket <- rnorm(10, mean=20000, sd=7000)
> Supermarket <- rnorm(15, mean=12000, sd=4000)
> Minimarket <- rnorm(20, mean=10000, sd=4000)
> Cornershop <- rnorm(20, mean= 8000, sd=3000)
> Spazashop <- rnorm(35, mean= 7000, sd=3000)
>
> i am trying to write a code to simulate data such that i have 10% of hypermarkets, 15% of supermarkets,etc.
>
>
>
>
> [[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.
>
>
More information about the R-help
mailing list