Upload
abhishek-kapoor
View
222
Download
0
Embed Size (px)
Citation preview
8/12/2019 R You Ready - 1st Session_v2
1/16
Ru ready
8/12/2019 R You Ready - 1st Session_v2
2/16
Divide and win
Group Red
Sravika
Radhika Reddy
Mamatha
Group Green
SudharsanReddy Yettapu
Swapna C
Grou
Vinit
Madh
Nave
8/12/2019 R You Ready - 1st Session_v2
3/16
So Why R???
Its free Yes we dont have to pay to buy licence It has a robust community used by academics and re
around the world
Graphics and data visualization lattice, ggplot2 (we later)
8/12/2019 R You Ready - 1st Session_v2
4/16
Basics of Data structure in R Vector- The fundamental of data structure in R. All the e
a vector must be of the same type
Integer (numbers without decimals) Numeric (numbers with decimals) Character (text data) Logical (TRUE or FALSE values)
Factors- A factor is a special case of vector that is solelyrepresenting nominal variables
List- special type of vector, unlike a vector that requires elements to be the same type, a list allows different typevalues to be collected
Data frame - a structure analogous to a spreadsheet or dasince it has both rows and columns of data
Matrix- A matrix is a data structure that represents a twodimensional table, with rows and columns of data. R matrcontain any single type of data
8/12/2019 R You Ready - 1st Session_v2
5/16
Vector
paitent_name
8/12/2019 R You Ready - 1st Session_v2
6/16
Factors
An advantage of using factors is that they are generalefficient than character vectors because the categoryare stored only once. Rather than storing MALE, MALEFEMALE, the computer may store 1, 1, 2. This can savmemory
gender
8/12/2019 R You Ready - 1st Session_v2
7/16
List Unlike vector that requires all elements to be the same type, a list allows different
values to be collected. Due to this flexibility, lists are often used to store various tyand output data
subject1
8/12/2019 R You Ready - 1st Session_v2
8/16
8/12/2019 R You Ready - 1st Session_v2
9/16
Data frame
In R terms, a data frame can be understood as a list oor factors, each having exactly the same number of vaBecause the data frame is literally a list of vectors, itcombines aspects of both vectors and lists
pt_data
8/12/2019 R You Ready - 1st Session_v2
10/16
Some useful function for data frame
How to read/load data in R read.csv (file name.csv, header =T, stringsAsFactors = FA
read.table( file name, header = T, sep = ,, stringsAsFacFALSE)
"csv" for comma-separated and "tab" for tab-separated
read.csv (file.choose(),header=T) (select the file)
How to save data in R write.csv(pt_data, file = "pt_data.csv")
save(pt_data, file = "pt_data.RData")
8/12/2019 R You Ready - 1st Session_v2
11/16
Lets start Running
rm (list =ls()) to remove data already in getwd () show the path where R operates
setwd ("D:/R learning/first class") to change th
install.packages (ca, dep=T)
library (ca)
library (help=ca) ----- tells about the package Help for any function
?read.csv () ??read.csv () Google/youtube
8/12/2019 R You Ready - 1st Session_v2
12/16
Exploring and understanding data
df
8/12/2019 R You Ready - 1st Session_v2
13/16
Exploring and understanding data
table(df$year) table(df$model)
table(df$color)
color_percentage
8/12/2019 R You Ready - 1st Session_v2
14/16
Case Study 1 Brand perception
How my brand is different from competition What consumer think of my Nokia vis a. viz Samsumg,
Micromax, HTC
Is my brand differentiated compared to competition
So how you as a analyst can help brand managerto solve above problem?
8/12/2019 R You Ready - 1st Session_v2
15/16
Data for Correspondence Analysis
rm (list =ls())
df
8/12/2019 R You Ready - 1st Session_v2
16/16
What Next???
Need to work on one case studies with these 2 techneach team
Assignment should be submit before Thursday
You need to take the data from Canon Wave 2 /Dentsu
Next Session --- 23/05/2014