This is a draft cheat sheet. It is a work in progress and is not finished yet.
Utility functions
1. Getwd() |
2. Setwd() |
3. ls() |
4. dir() |
5. install.packages("ade4") |
6. library(ade4) |
7. help.start() |
8. detach(package:ade4) |
9. history() |
Types of data structures
Data Struccture |
1. Lists |
2. Vectors |
a) Numeric |
Student_Weight <- list(12, 8, 14, 11, 9) |
natural_numbers<-c(1:9) |
b) Character |
dinner_options <- list("Roti", "Dosa", "Rice", "Idli", "Bhakri") |
fruit <- c("oranges", "apples", "bananas") |
c) Logical |
France_wins_worldcup <- list(FALSE, FALSE, TRUE, FALSE) |
response <- c(FALSE, FALSE, TRUE, FALSE) |
d) Multiple object |
Row1 <- list("Lalitha", 44, "yes", TRUE) |
|
|
|
|
R loops
if |
if and else |
ifelse |
switch |
loop using increment variable |
loop using list object iterator |
|
|
R plots
histogram |
density plot |
bar chart |
qplot |
line chart |
facet_grid |
|