# NOT RUN {
N <- 10; shape <- 0.5; y <- 1:N
proby <- dzipf(y, N = N, shape = shape)
# }
# NOT RUN {
 plot(proby ~ y, type = "h", col = "blue", ylab = "Probability",
     ylim = c(0, 0.2), main = paste("Zipf(N = ",N,", shape = ",shape,")", sep = ""),
     lwd = 2, las = 1) 
# }
# NOT RUN {
sum(proby)  # Should be 1
max(abs(cumsum(proby) - pzipf(y, N = N, shape = shape)))  # Should be 0
# }
Run the code above in your browser using DataLab