SlideShare a Scribd company logo
1 of 30
Download to read offline
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Why ???
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
• Manage your Workspace
• Data types
• Fiddle with Data Types
• Lists Vs Vectors
• R as calculator!!!
• Decision making statements, looping, functions
• Interact with R!!!
• Visualization!!!
• Time for U!!!
• Clustering
• Regression (with curve fitting)
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )








©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Data types
• R has five basic or “atomic” classes of objects:
1. character
2. numeric (real numbers)
3. integer
4. complex
5. logical (True/False)
• The most basic object is a vector
• Empty vectors can be created with the vector()
function.
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Fiddle with Data types













©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Lists Vs Vecto s
Lists are set of heterogeneous elements.
Vectors is a set of homogeneous elements.
 num = c(22, 33, 55) # vector HOMOGENEOUS
 srs= c("aaa", "bbb", "cc", "dd", "ee") # vector HOMOGENEOUS
 bool = c(TRUE, FALSE, FALSE, FALSE, FALSE) # vector
HOMOGENEOUS
 x = list(num, srs, bool, 3) # x contains copies of num, srs, bool;
Lists HETEROGENEOUS
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
as calculato !!!
5+6
5+6*5
y <- c(1,2,4,5)
z <- 1:4
“kaisi ho??”
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Decision statements, Looping &
Functions
a<-function(x,y){
if(x>y){
return (x)
}
else {
return (y)
}
}
a(20,10)
for(m in 1:3){
print(m)
}
x=0
while(x<5){
print("hi")
x=x+1
}
lapply(1:3, function(x) x^2) x=0
repeat{
print("hi")
x=x+1
if(x==5){
break
}
}
R doesn’t process loops quickly. Try lapply.
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
 mydata<-read.csv("solaRdata.csv") #loading & reading data
 mydata
 summary(mydata) #statistical overview
 read.csv(file = "solaRdata.csv", sep= ",")[ ,1:2] #display only
first and second column, EXTRACTION of relevant data
 mydata<-na.omit(mydata) #to omit the columns having ‘NA’ #cleaning of data
 max(mydata) #shows maximum value present in the entire data, analysis of data
 max(mydata[ ,c('Attitude')]) #select ur girl friend ->max atitude
 max(mydata[ ,c('Look')]) #select your girl friend on basis of look
 write.csv(mydata, file = "MyData.csv")
 read.csv("Mydata.csv")
P.S. “solaRdata.csv” must be present in your current working directory.
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Lets see how it looks!!!
x<-read.csv(file = "solaRdata.csv", sep= ",")[ ,1]
y<-read.csv(file = "solaRdata.csv", sep= ",")[ ,2]
plot(x,y) # analysis of data
hist(y, col="pink", xlab="Solar Radaition",ylab="Frequency")
slices <- c(50,105,300)
lbls <- c("2012", "2013", "2014(counting)")
pie(slices, labels = lbls,col=rainbow(length(lbls)),
main="No. of fans of HIT-K ACM Student chapter")
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Its time fo U!!!!
1. Display first and second rows of solaRdata.csv
2. Display the minimum value present in the
entire dataset
3. Find maximum element in First row
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
1. read.csv(file = "solaRdata.csv", sep= ",")[1:2,]
2. min(mydata)
3. max(read.csv(file = "solaRdata.csv", sep= ",")[ 1,])
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Welcome to Advanced 101
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
2 Inte esting Applications!!
CLUSTERING
CURVE FITTING
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Curve Fitting
• Curve fitting is the process of constructing a curve,
or mathematical function, that has the best fit to a
series of data points, possibly subject to
constraints.
If you just had a feel its like
the ones you learn in your
degree courses…….here is some
you can try hands on..
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Did this cause a problem??
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
This is where R kicks in!!
• THE REGRESSION MODEL
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Types of egression
• Linear Regression
• Non linear regression
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Some more theory
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
THE DATA:
mydata<-read.csv(“Rdata.csv”)
newdata <- mydata[,1:2]
print(newdata)
y<-newdata[,2]
x<-newdata[,1]
plot(x,y)
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
• f<-lm(y~x)
• xx <- seq(00,350, length=350)
• lines(xx, predict(f, data.frame(x=xx)), col="red")
• f<-lm(y~poly(x,2,raw=TRUE))
• lines(xx, predict(f, data.frame(x=xx)), col="green")
• f<-lm(y~poly(x,10,raw=TRUE))
• lines(xx, predict(f, data.frame(x=xx)), col="blue")
• summary(f)
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
luste 
Many to pick from!!
–Connectivity based clustering
–Centroid based clustering
–Distribution based clustering
–Density based clustering
–A Lot more…
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Means(Centroid based Approach)
1.Place K points into the space represented by the objects that are being
clustered. These points represent initial group centroids.
2.Assign each object to the group that has the closest centroid.
3.When all objects have been assigned, recalculate the positions of the K
centroids.
4.Repeat Steps 2 and 3 until the centroids no longer move. This produces a
separation of the objects into groups from which the metric to be minimized
can be calculated.
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
So here is how it goes….
• Mydata<-read.csv("Rdata.csv")
• newdata<-mydata[,2:3]
• print (newdata)
• (kc <- kmeans(newdata, 3))
• summary(kc)
• plot(newdata[c("Complextion", "Smartness")],
col=kc$cluster)
• points(kc$centers[,c("Complextion", "Smartness")],
col=1:3, pch=8, cex=2)
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
Bibliography
• http://www.slidesshare.net
• http://images.google.com/
• http://en.wikipedia.org
• http://cran.r-project.org/
• http://www.statmethods.net/
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )

More Related Content

Recently uploaded

毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queensdataanalyticsqueen03
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理e4aez8ss
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxBoston Institute of Analytics
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一F La
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...limedy534
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfBoston Institute of Analytics
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改yuu sss
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.natarajan8993
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样vhwb25kk
 

Recently uploaded (20)

毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲中央昆士兰大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
Top 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In QueensTop 5 Best Data Analytics Courses In Queens
Top 5 Best Data Analytics Courses In Queens
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
科罗拉多大学波尔得分校毕业证学位证成绩单-可办理
 
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptxNLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
NLP Project PPT: Flipkart Product Reviews through NLP Data Science.pptx
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
 
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
办理(Vancouver毕业证书)加拿大温哥华岛大学毕业证成绩单原版一比一
 
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
Effects of Smartphone Addiction on the Academic Performances of Grades 9 to 1...
 
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdfPredicting Salary Using Data Science: A Comprehensive Analysis.pdf
Predicting Salary Using Data Science: A Comprehensive Analysis.pdf
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
专业一比一美国俄亥俄大学毕业证成绩单pdf电子版制作修改
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.RABBIT: A CLI tool for identifying bots based on their GitHub events.
RABBIT: A CLI tool for identifying bots based on their GitHub events.
 
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
1:1定制(UQ毕业证)昆士兰大学毕业证成绩单修改留信学历认证原版一模一样
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

R programming Basic & Advanced

  • 1. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 2. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 3. Why ??? ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 4. • Manage your Workspace • Data types • Fiddle with Data Types • Lists Vs Vectors • R as calculator!!! • Decision making statements, looping, functions • Interact with R!!! • Visualization!!! • Time for U!!! • Clustering • Regression (with curve fitting) ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 5. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 7. Data types • R has five basic or “atomic” classes of objects: 1. character 2. numeric (real numbers) 3. integer 4. complex 5. logical (True/False) • The most basic object is a vector • Empty vectors can be created with the vector() function. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 8. Fiddle with Data types              ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 9. Lists Vs Vecto s Lists are set of heterogeneous elements. Vectors is a set of homogeneous elements.  num = c(22, 33, 55) # vector HOMOGENEOUS  srs= c("aaa", "bbb", "cc", "dd", "ee") # vector HOMOGENEOUS  bool = c(TRUE, FALSE, FALSE, FALSE, FALSE) # vector HOMOGENEOUS  x = list(num, srs, bool, 3) # x contains copies of num, srs, bool; Lists HETEROGENEOUS ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 10. as calculato !!! 5+6 5+6*5 y <- c(1,2,4,5) z <- 1:4 “kaisi ho??” ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 11. Decision statements, Looping & Functions a<-function(x,y){ if(x>y){ return (x) } else { return (y) } } a(20,10) for(m in 1:3){ print(m) } x=0 while(x<5){ print("hi") x=x+1 } lapply(1:3, function(x) x^2) x=0 repeat{ print("hi") x=x+1 if(x==5){ break } } R doesn’t process loops quickly. Try lapply. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 12.  mydata<-read.csv("solaRdata.csv") #loading & reading data  mydata  summary(mydata) #statistical overview  read.csv(file = "solaRdata.csv", sep= ",")[ ,1:2] #display only first and second column, EXTRACTION of relevant data  mydata<-na.omit(mydata) #to omit the columns having ‘NA’ #cleaning of data  max(mydata) #shows maximum value present in the entire data, analysis of data  max(mydata[ ,c('Attitude')]) #select ur girl friend ->max atitude  max(mydata[ ,c('Look')]) #select your girl friend on basis of look  write.csv(mydata, file = "MyData.csv")  read.csv("Mydata.csv") P.S. “solaRdata.csv” must be present in your current working directory. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 13. Lets see how it looks!!! x<-read.csv(file = "solaRdata.csv", sep= ",")[ ,1] y<-read.csv(file = "solaRdata.csv", sep= ",")[ ,2] plot(x,y) # analysis of data hist(y, col="pink", xlab="Solar Radaition",ylab="Frequency") slices <- c(50,105,300) lbls <- c("2012", "2013", "2014(counting)") pie(slices, labels = lbls,col=rainbow(length(lbls)), main="No. of fans of HIT-K ACM Student chapter") ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 14. Its time fo U!!!! 1. Display first and second rows of solaRdata.csv 2. Display the minimum value present in the entire dataset 3. Find maximum element in First row ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 15. 1. read.csv(file = "solaRdata.csv", sep= ",")[1:2,] 2. min(mydata) 3. max(read.csv(file = "solaRdata.csv", sep= ",")[ 1,]) ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 16. Welcome to Advanced 101 ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 17. 2 Inte esting Applications!! CLUSTERING CURVE FITTING ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 18. Curve Fitting • Curve fitting is the process of constructing a curve, or mathematical function, that has the best fit to a series of data points, possibly subject to constraints. If you just had a feel its like the ones you learn in your degree courses…….here is some you can try hands on.. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 19. Did this cause a problem?? ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 20. This is where R kicks in!! • THE REGRESSION MODEL ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 21. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 22. Types of egression • Linear Regression • Non linear regression ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 23. Some more theory ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 24. THE DATA: mydata<-read.csv(“Rdata.csv”) newdata <- mydata[,1:2] print(newdata) y<-newdata[,2] x<-newdata[,1] plot(x,y) ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 25. • f<-lm(y~x) • xx <- seq(00,350, length=350) • lines(xx, predict(f, data.frame(x=xx)), col="red") • f<-lm(y~poly(x,2,raw=TRUE)) • lines(xx, predict(f, data.frame(x=xx)), col="green") • f<-lm(y~poly(x,10,raw=TRUE)) • lines(xx, predict(f, data.frame(x=xx)), col="blue") • summary(f) ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 26. luste  Many to pick from!! –Connectivity based clustering –Centroid based clustering –Distribution based clustering –Density based clustering –A Lot more… ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 27. Means(Centroid based Approach) 1.Place K points into the space represented by the objects that are being clustered. These points represent initial group centroids. 2.Assign each object to the group that has the closest centroid. 3.When all objects have been assigned, recalculate the positions of the K centroids. 4.Repeat Steps 2 and 3 until the centroids no longer move. This produces a separation of the objects into groups from which the metric to be minimized can be calculated. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 28. So here is how it goes…. • Mydata<-read.csv("Rdata.csv") • newdata<-mydata[,2:3] • print (newdata) • (kc <- kmeans(newdata, 3)) • summary(kc) • plot(newdata[c("Complextion", "Smartness")], col=kc$cluster) • points(kc$centers[,c("Complextion", "Smartness")], col=1:3, pch=8, cex=2) ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 29. Bibliography • http://www.slidesshare.net • http://images.google.com/ • http://en.wikipedia.org • http://cran.r-project.org/ • http://www.statmethods.net/ ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )
  • 30. ©Angan Mitra (anganconnorlinconmitra@gmail.com), Sohom Ghosh (sohom1ghosh@gmail.com )