Friday, January 25, 2008

Installing and basic plotting in R


Windows users:
http://cran.r-project.org/bin/windows/base/
Download R-2.6.1-win32.exe and install it like any program.
Start it like any other program from the start menu

Linux users:
s
udo apt-get install r-base
Just type R in the terminal

Read in a file
Go into excel or even a text editor and create a simple data set like this:
1,3
2,5
2,6
3,8
4,4
6,3
7,9
Where the second column is after the comma.
Save your file as a .csv
Look up where you saved it and insert that as the location in the following code:
data<-read.table("/home/eldon/Desktop/data.csv",sep=",") #this reads in your data and assigns it to the data frame "data"
plot(data) #this gives you a simple plot of your data
If you want to learn more about simple plotting just enter:
help(plot)

No comments: