R

R is a free stats program that can plot data.

It is available as a cygwin port. To plot data, you must also have X installed.

It is started using "R", it should load up and the prompt will change to >

Basics

help(command)

tab complete works.

to print the value of a variable "foo", run:

foo or do it during assignment (foo=33)

Assignment

a=5

or

a <- 5

Datatypes

Variables are used in R

I've found the following basic datatypes:

> class(FALSE) [1] "logical" > class(3) [1] "numeric" > class("hello") [1] "character"

vectors are n ordered sequence. repetitions are allowed.

c is the concatenate function.

> foo = c(1,6,3,2) > foo [1] 1 6 3 2

seq helps create vectors of numbers

seq(0,10, 0.25)

above is from 0 to 10 inclusive, step of .25

seq takes ordered params but can also take named params. from, to, by, length.out

help(seq) seq(0, 10, by=0.25) seq(0, 10, length.out=5) [1] 0.0 2.5 5.0 7.5 10.0

create a vector of length 5.

30:40

creates a vector from 30 to 40 step 1.