Updated R scripts