You are on page 1of 17

R Data Analytics – Basic

Tushar B. Kute,
http://tusharkute.com
Prerequisites

• Please read the previous presentations on


R Programming. Follow the below link:
http://mitu.co.in/r­presentations 
Problem Statement:

• Perform the following operations using R on the


Amazon book review and facebook metrics data
sets
1) Create data subsets
2) Merge Data
3) Sort Data
4) Transposing Data
5) Melting Data to long format
6) Casting data to wide format
Facebook Metrics : Download
The dataset

fb.csv
Import the dataset

• read.csv()
– Reads a csv file in table format and creates a
data frame from it, with cases corresponding to
lines and variables to fields in the file.
Import the dataset
Reads csv file

No. of columns

No. of rows

First six entries


Creating the subset

Create subset

Store in csv file


Creating the subset

• subset( )
– Return subsets of vectors, matrices or data frames which
meet conditions.
– Usage:
subset(x, ...)
## Default S3 method:
subset (x, subset, ...)
## S3 method for class 'matrix'
subset (x, subset, select, drop = FALSE, ...)
## S3 method for class 'data.frame'
subset (x, subset, select, drop = FALSE, ...)
Creating the subset

Subset condition
New dataset of same columns

newfb.csv
Merge Datasets

Shows the dimensions (rows, columns

Binds both data frames


Sort Datasets

Sort by share
- for descending
Transpose Datasets

Finds the transpose


Melt data to long format

Melt the dataset


Casting dataset
Thank you
This presentation is created using LibreOffice Impress 5.1.6.2, can be used freely as per GNU General Public License

/mITuSkillologies @mitu_group

Web Resources
http://mitu.co.in
http://tusharkute.com

tushar@tusharkute.com

You might also like