Step 1 reads the data, and step 2 plots it as a line chart.
Step 3 uses the diff function to generate single-period differences. It then uses the plot function to plot the differences. By default, the diff function computes single-period differences. You can use the lag argument to compute differences for greater lags. For example, the following calculates two-period lagged differences:
> diff(wmm$Adj.Close, lag = 2)
Step 4 generates a histogram of one-period price changes. It uses prob=TRUE to generate a histogram based on proportions and then adds on a density plot as well to give a higher-granularity view of the shape of the distribution.
Step 5 computes one-period returns for the stock by dividing the one-period differences ...