I am trying to reproduce the following figure from the autocorrelation Wikipedia page:
My R code is:
f = rep(c(0,1,0), each=100) acf(f)