Show Menu
Cheatography

Introduction to Package R Cheat Sheet (DRAFT) by

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. instal­l.p­ack­age­s("a­de4­")
6. librar­y(ade4)
7. help.s­tart()
8. detach­(pa­cka­ge:­ade4)
9. history()

Types of data structures

Data Struccture
1. Lists
2. Vectors
a) Numeric
Studen­t_W­eight <- list(12, 8, 14, 11, 9)
natura­l_n­umb­ers­<-c­(1:9)
b) Character
dinner­_op­tions <- list("R­oti­", "­Dos­a", "­Ric­e", "­Idl­i", "­Bha­kri­")
fruit <- c("o­ran­ges­", "­app­les­", "­ban­ana­s")
c) Logical
France­_wi­ns_­wor­ldcup <- list(F­ALSE, FALSE, TRUE, FALSE)
response <- c(FALSE, FALSE, TRUE, FALSE)
d) Multiple object
Row1 <- list("L­ali­tha­", 44, "­yes­", TRUE)
   

Dataframes

 

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