R is an interpreted language designed to do effective vector and matrix calculations for scientific purposes (Scientists are the only people who like arrays and data frames etc.)
R is amazing because:
- It's free
- It's multi platform
- It's actively developed
- It has wide community of package developpers
- It has command line - interpretted language
- It can draw beautiful graphs
- It's easy
- Soooo much more
Let's have a look at what R can do:
https://gallery.shinyapps.io/086-bus-dashboard/ (definitely questionable as far as usefullnes goes, but what the heck)
In [7]:
library(ggplot2)
head(mpg) #function
summary(mpg) #function
g = ggplot(mpg, aes(class))
# Number of cars in each class:
g + geom_bar()
Lets have a look at some statisticss
In [8]:
mpg = ggplot2::mpg
# fitting simple anova model
cty_man_aov = aov(cty ~ manufacturer, mpg)
summary(cty_man_aov)
Looks like there is something going on. Let's plot it.
In [9]:
g = ggplot(mpg, aes(manufacturer, cty))
g + geom_boxplot()
Our job is done, paper published.
In [ ]:
number = 5
string = "Hello World!"
There are simple math problems
In [ ]:
5 * 5
5 * num
10 % 7
There are simple comparisons
In [ ]:
5 == 1
5 >= number
"Hello World!" != string
And there are functions
In [18]:
vector = c(1:10)
sum(vector)
max(vector)
paste(vector, collapse = "-")
There are graphs
In [23]:
hist(iris$Sepal.Length)
There are comments
In [24]:
number = 5
# I will not do anything that is written like this
# number = 6
print(number)
There is embedded help
In [26]:
?max