Running your script directly in the R console (instead of within RStudio) might help, as RStudio can sometimes introduce additional memory overhead or restrictions. Are you on Windows?