An example of running R script for Chapter 9, problem 3

I just have gone over running R under Mac OS X. With one minor modification, this is also applicable to Windows (without RExcel).


Here is a little tutorial (I am assuming you already have R).
  • Save this data file to your 'Desktop': Ch9p3.txt
  • Save this script to your 'Desktop': Ch9p3Script.R
  • Optional. Check that your files open, by clicking on them. The script will open with R, and the datafile with TextEdit (on Mac) and with Notepad (on Windows).
  • Start R
  • From the menu bar at the top, choose 'Misc/Change Working Directory' (Mac users) or 'File/Change Working Directory (Windows users). Set the working directory to the 'Desktop'. (Mac users: You can alternatively press Apple key followed by D to do this step, as the Misc menu shows).
  • Type this into the R GUI console:
    	  > source("Ch9p3Script.R", echo=T)
  • Watch the output. It solves WebAssign problem 3 for my randomization.