Version: 3.3.1 (Denali & Wavelet) 3.4.3 (RAS cluster)
Platforms : Linux, Windows and Macintosh
How to use R
Connect to “denali.pstat.ucsb.edu”(refer Cluster Information and then run it (type “R”).
Introduction to R
R is kind of a free version of Splus. The commands for R and S plus are virtually the same. Now, to access R in Linux, one must first open the UNIX Shell. Next you type in the command line sshdeathstar.pstat.ucsb.edu and then it will ask for your cluster password.Once you are in cluster you type R and press enter.You will now be in R.
Using R in Linux is different then using S-plus in Windows because when using R in Linux you do not have a graphical interface.There are different ways to input commands into R.Some of the methods are as follows.One way is to write your R script in a text editor and then copy and paste onto R.Once you paste it onto R, R will proceed to run your code.Another way is to write your script in a text editor, like KWrite, then save it into your R working directory (to find out what your working directory is type the command getwd() in R and press enter).Then in R type source(filename, echo=TRUE). After pressing enter, R will run the script and will show the output of each command.If you wish not to see the output of each command in your script just type source(filename).You may use the function source with any text file, like an S-plus script file.Any S-plus script file that you have that runs on S-plus, with little modification, should also run on R.You may also run your R session in the editor Emacs by running the UNIX shell in the Emacs editor itself by pressing alt-x and typing shell then pressing enter.This will open up the shell window in Emacs.
Note: In general, your working directory in R will be the directory that you were in when R was opened.Also you may copy any text output from R simply by highlighting it and copying.Then you may paste in any editor or word processing program.
Working with Plots
Creating plots in R is not difficult.To create a plot you must always issue the command line x11() before issuing a plot command.The command x11() opens a device window to view the plot.To save your plots in a .pdf, .jpeg, or .png format so that you may view them at a later time or insert into a document you must first specify the format.For example to save one of your plots as a jpeg image, you must first issue the following commandjpeg(¡°filename.jpeg¡±), instead of issuing x11(), before issuing a plot command.After you run your plot command, a file called filename.jpeg will now be in your R working directory. To view filename.jpeg, you first issue the command graphics.off(), and then you may open your file to view it.For the .png format you would use png(¡°filename.png¡±) and for the .pdf format you would use pdf(¡°filename.pdf¡±).
If you need help, please email at email@example.com