Code for a simulated boostratp in R