This R script is used to esimate the window-sliding pi value and plot the pi diversity of a region.