These scripts are meant to be run from the command line. Save the eigenplot.R script attached. You can then run it from the command line as such
Rscript eigenplot.R --val Path/to/pca.eigencal --vec Path/to/pca.eigenvec --o /directory/to/output
This will make the pdf file pca_plots in the specified output directory.