# brain of mat kelcey

## simple statistics with R

October 03, 2009 | View Comments

i'm learning a new statistics language called R and it's pretty cool.

make a vector ...

 1 2 > c(3,1,4,1,5,9,2,6,5,3,5,8) [1] 3 1 4 1 5 9 2 6 5 3 5 8 

turn it into a frequency table ...

 1 2 3 > table(c(3,1,4,1,5,9,2,6,5,3,5,8)) 1 2 3 4 5 6 8 9 2 1 2 1 3 1 1 1 

sort by frequency ...

 1 2 3 > sort(table(c(3,1,4,1,5,9,2,6,5,3,5,8))) 2 4 6 8 9 1 3 5 1 1 1 1 1 2 2 3 

and plot!

 1 > barplot(sort(table(c(3,1,4,1,5,9,2,6,5,3,5,8)))) 

so simple!