Added .RData to .gitignore.
Moved core functionality to library function.
Added shell script to run main.R.
Added batch script to run main.R.