"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

August 16, 2015

R Online Learning


I prefer to switch topics when I find it tricky to focus on one topic. I found R language easy, simple and great to get started. Codeschool has a beautiful self learning portal. This lists cheat sheet and fundamentals working with R. Capturing some of notes for my future reference.

Using R

Tip #1 - Assignment
x <- 42
y <- "Hello"

Tip #2 - Expression
5==10
5>10

Tip #3 - Arithmetic operations
2+2
3*3

Tip #4 - Functions
sum(1,2)
sum(1,2,3,4)

Help

Tip #5 - File I/O
list.files()
source(filename)

Vectors

Tip #1 - Vector
List of Values - vector represented by c(2,3,4)
List of Strings - vector represented by c('a','b','c')
List with multiple data types - vector represented by c(1,'a', TRUE)

Tip #2 - Sequence Vectors
Representing sequence of numbers m to b by m:n
 - seq(10,50)
 - seq(10,50,5) - With increment step 5
 - seq(50,10) - Reverse sequence representation

Tip #3 - Assigning Vectors (Single Quotes)
sentence <- c('walk', 'the', 'plank')
sentence[3]
a <- c (1,2,3)
b <- c (1,2,3)

Sample Vector Operations
a+1
a*2
a+b

x <- seq(1, 20, 0.1)
y <- sin(x)

Tip #4
c for combine vectors
c(1,2,3)

Tip #5
Plotting Vectors
vectorCoordinates <- c(4, 5, 1)
barplot(vectorCoordinates)
barplot(1:100)

x <- seq(1, 20, 0.1)
y <- sin(x)
plot(x,y)

Great Learning Sites
Statsmethod
Code School

Happy Learning!!!

No comments: