by Andrie de Vries
I am developing the wakefield package to address this need to quickly share reproducible data, sometimes dput() works fine for smaller data sets but many of the problems we deal with are much larger, sharing such a large data set via dput() is impractical.
I think it is a brilliant idea to create a package that allows you to easily create data with a specified structure.
The package has some very clever ideas. It contains functions that "knows" about certain data types, e.g. age() generates age ranges and coin() generates a bernoulli sample, to name just a few. You can also specify correlation between variables – a helpful feature if you want to demonstrate a specific statistical model.
The package is not yet on CRAN, but is extensively documented at github.
wakefield is designed to quickly generate random data sets. The user passes
n(number of rows) and predefined vectors to the
r_data_framefunction to produce a
Here is an example from the documentation (modified only very slightly):
This produces the following plot. Notice the correlation in the data – people with high initial grades tend to maintain high grades over time, and vice versa.
Installation and more examples
To install the package, uncomment the first two lines of code and try the examples: