rw30 | R Documentation |
Generate Random Walks
rw30()
The function generates random walks using the normal distribution with a
specified mean (mu
) and standard deviation (sd
).
Each walk is generated independently and stored in a tibble. The resulting
tibble is then pivoted into a long format for easier analysis.
A tibble in long format with columns walk
, x
, and value
,
representing the random walks. Additionally, attributes num_walks
,
num_steps
, mu
, and sd
are attached to the tibble.
Steven P. Sanderson II, MPH
This function generates 30 random walks with 100 steps each and pivots the result into a long format tibble.
# Generate random walks and print the result
set.seed(123)
rw30()
set.seed(123)
rw30() |>
visualize_walks()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.