[R] SRS Required sample size for simulated data

Robert Baer rbaer at atsu.edu
Wed Sep 9 15:39:25 CEST 2009


My guess is that by "table" you are really looking for a 'dataframe'. 
Further, I guess that an indexed format is most useful to you.
Try:

# Create the requested dataframe
 dat=data.frame(type=c(rep("Hypermarket",10),rep("Supermarket",15),rep("Minimarket",20),rep("Cornershop",20),rep("Spazashop",35)),                value=c(Hypermarket,Supermarket,Minimarket,Cornershop,Spazashop))#  Print out first 15 rows. dat[1:15,]R helpersPlease help me combine the simulated data to a form of table where:Hypermarket have 10 rows, supermarket have 15 rows,......., spazashops with35 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% ofhypermarkets, 15% of supermarkets,etc.[[alternative HTML version deleted]]-----Inline Attachment Follows-----______________________________________________R-help at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.[[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 guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.>




More information about the R-help mailing list