Purrrification of data: Some examples
A First Example To generate a collection of 100 normally distributed random number, we use: rnorm(100) We can repeat this process indefinitely for \(n\) times, and when \(n = 9\), we have the following collections: collection_1 <- rnorm(100) collection_2 <- rnorm(100) collection_3 <- rnorm(100) collection_4 <- rnorm(100) collection_5 <- rnorm(100) collection_6 <- rnorm(100) collection_7 <- rnorm(100) collection_8 <- rnorm(100) collection_9 <- rnorm(100) which we can conveniently regroup into a larger collection of random numbers: larger_collection <- c( collection_1, collection_2, collection_3, collection_4, collection_5, collection_6, collection_7, collection_8, collection_9 ) Alternatively, we can use the rerun shorthand to define that the aforementioned collection: list_of_numbers <- rerun(9, rnorm(100)) Each of the vector $$\mathbf{x}^{(d)} = \begin{pmatrix}x_1^{(d)} & x_2^{(d)} & \ldots &a