## Control Structures in R

This tutorial looks at some of the common control structures in R. Control Structures define the flow of the program and decides which path the program takes. This decision is based on the evaluation of a variable. These are the basic types of control structures: Introduction if a variable satisfies a particular condition follow path … Read more

## Data Structures in R, Data Frame Operations

In the previous tutorial we saw an introduction to factors and data frames in R. In this tutorial we look at some more functions that can be used on data frames. Multiple columns into single column – stack() The first function that we look at today is the stack function. It can be used to … Read more

## Data Structures in R – factors and Data Frame

In the earlier tutorials we learnt vectors, list, arrays and matrix. In this tutorial we will look at factors and data frame Factors Factors in R store categorical data. Categorical data has discreet values. For example, a vector of months of births of students in a class contains discreet values or categorical data. Their class … Read more

## Data Structures – Matrix and Array in R

In the previous tutorial we saw atomic vectors and list. In this tutorial we look at Matrix and Array in R. Array 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. Here’s an example: > array(1:8,dim=c(2,2,2)) , , 1 … Read more

## Basic Data Structures in R

The basic data structures in R can be divided in to two types Types of data structures Homogeneous All the elements in the data structure are of same type (string, number, boolean etc) Heterogeneous The elements in the data structure can be of mixed type. Basic Data structures in R Here are the basic data … Read more

## Source R File

In this tutorial we look at how to Source R File from the console. R commands can be run from a file using the source command. create a test file called test.R vi test.R add the following line in the file cat(“Sourcing from R file\n”) Now open R and fire this command (give the absolute … Read more

## List all Objects in R

All entities in R are called objects. They can be arrays, numbers, strings, functions. In this tutorial we look at how to list all objects in R. Get a list of all objects function name : objects() or ls() the objects() or ls() function can be used to get a vector of character strings of … Read more

## Assignment Operators in R

Two important assignment operators in R are <- and = . Lets look at some examples. This first example assignes 3 to variable x. Notice that a space before and after the assignment operator makes the code more readable. > x <- 3 > x  3 > It is also possible to chain assignments … Read more

How to Start R?

## 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 – … Read more

Categories R