Generate a Random Walk in R

Your goal

You need to generate a random walk series in R.

Step-by-step tutorial

A random walk is just cumulative white noise. So here's how to generate a random walk:

> white.noise <- ts(rnorm(1000))
> random.walk <- ts(cumsum(white.noise))

To plot it:

> plot(random.walk)
A random walk
A random walk