# 15 Page Tutorial for R

For Beginners in R, here is a 15 page example based tutorial that covers the basics of R.

- Starting R – Trivial tutorial on how to start R for those just wondering what to do next after downloading R.
- Assignment Operator – Two important assignment operators in R are <- and =
- Listing Objects – All entities in R are called objects. They can be arrays, numbers, strings, functions. This tutorial will cover topics such as listing all objects, listing object from a specific environment and listing objects that satisfy a particular pattern.
- Sourcing R File – R code can also be written in a file and then the file can be called from the R code.
- Basic Datastructures in R – Understanding data structures is probably the most important part of learning R. This tutorial covers vector and list. It also covers subsetting.
- Data Structures in R, Matrix and Array – Covers matrix and vectors. An array is a vector with additional attributes dim which stores the dimension of the array and dimnames which stores the names of the dimensions. A matrix is an 2 dimensional array. Head to the tutorial for examples of both.
- Data Structures in R, factors and Data Frame – DataFrames are probably the most widely used data structure. It would help to just go through the examples and practice them. The tutorial covers important operations on the data frame and factors as well as subsetting data frames.
- Data Structures in R, Data Frame Operations – Covers some more operations on the data frame; including stack, attach, with, within, transform, subset, reshape and merge
- Control Structures in R – The basics of any programming language. Control loops allow looping through data structures. The tutorial covers if, if-else, for, while, next, break, repeat and switch
- Control Structures in R – apply – To make looping more efficient R has introduced a family of ‘apply’ functions. For example – the apply function can be used apply a function over specific elements of an array (or matrix). The tutorial covers lapply, sapply, apply, tapply.
- Control Structures in R – apply 2 – We continue with some more apply functions – mapply and by.
- Functions in R – The nuts and bolts of any programming language. This tutorial not only explains the concept of functions using examples but also covers various scenarios such as anonymous functions or passing functions around.
- Printing on Console in R – Printing on console can come very handy. The tutorial covers the print and cat functions as well as printing data frames.
- Pretty printing using Format function in R – This tutorial looks at how to use the formatting functions for pretty printing.
- Reshape and Reshape2 Package – Once you start working on real life problems in R, a lot of time would be spent on manipulating data. Reshape and Reshape2 package will prove very powerful in converting data to the format required by other libraries. This tutorial has detailed examples to explain the package.

These tutorials are designed for beginners in R, but they can also be used by experienced programmers as a refresher course or as reference. Running loops in R can be slow and therefore the apply group of functions as well as the reshape package can drastically improve the performance of the code.

We hope you enjoy the tutorials.