R is a terrific tool for data analysis. R has a couple of options for scripting. The littler option mentioned previously is harder to use, because you have to install additional stuff into the system. I would probably not recommend this for right now. Instead, I would look at Rscript. To learn more enter:
after you have installed R. The man page is useful. If you have already started R, then you can use:
Your other is to write an executable script that can use R, in the same way a python script uses python. In the first line of your script you will need something that looks like:
If you want you learn R, I would recommend two resources. First, _the_ PDF on R is:
args <- commandArgs(TRUE)
blah blah blah blah blah
#q(status=<exit status code>)
Secondly, there is the site Quick-R. This second resource is especially useful to anyone with a background in SPSS / PSPP.
Since this _is_ a homework assignment, I don't want to give the whole shebang away, and I have technically told you how to write 90% of the script already. I'll let you read R-intro. It's boring but informative. The stuff in the very back discusses scripting R from the command line.
If you have any specific questions, feel free to post them, but do be aware that the Ubuntu Forums do have a policy against answering homework questions directly/completely.