fix minor bug in R script for tests