I have a small 20k (176 variables) test dataset. I want to create a random bigger dataset for testing, using the rows (data) and columns (names) from the small dataset.
Currently I have:
real_data <- read.csv("somefilehere.csv") # load one fake row so assignment of column names won't *ahem* complain test_data <- data.frame(real_dat[1,]) colnames(test_data) <- colnames(real_data)
So, this sets my test_data dataframe to have the same column names as the real data.
How can I run through all the column names and then randomize test_data with existing values from real_data?
The following code works perfectly for randomizing a sample from the existing row:
How do I use iteration of the columns, together with the sample function to populate test_data automatically? Doing manual assignments for every variable would take forever, maybe there is a function in R that I'm missing as a 3 week beginner?
I'm working with R, knitr and LaTeX for processing and would like to use the test_data set for use in my statistical tests and graphs (to see if my document scales well with larger numbers, and my legends still look ok etc).
 An example with randomly picked R dataset.
Dataset: warpbreaks - load with data(warpbreaks)
Currently it has 3 already defined columns and 54 observations.
How do I create a new dataset called warpbreaks_huge, that has the same column names, but say 25 million observations? Also, from the existing dataset we can see that the tension column has default values L, M and H. The wool column has default values of A and B.
I guess my question is, how do you create a randomized bigger populations programmatically?
Apologies for my naive phrasing. I'm new at this environment.