simulations with error in r