Data visualization using R | Customer Churn | Exploratory Data Analysis

Photo by Chris Liverani on Unsplash

Table of content

1. Introduction

2. View the data& data preprocessing

#you only need to install the package if you don't have ggplot installedinstall.packages('ggplot2', dependencies = TRUE)#call library
library(ggplot2)
View(telco.df)
some raw data in the dataset
str(telco.df)

Data Cleaning Steps

3. Comparison chart

Pie chart

Bar chart

#code snippet for bar chartggplot(telco.df, aes(x=variable,fill=Churn))+ geom_bar() + labs(title="your title", x="x axis", x="y axis")

line chart

#code snippet for line chartggplot(data = telco.df) + geom_line(aes(x=tenure, y= variable, color=Churn))ggplot(data,aes(x = tenure, color=Churn)) + geom_freqpoly(size=2)

4. Distribution Chart

Scatter plot

#code snippet for scatter plotggplot(data=telco.df) + geom_point(aes(x=MonthlyCharges, y=TotalCharges))

Box plot

#code snippet for box plotggplot(data=telco.df) + geom_boxplot(aes(x=Churn,y=TotalCharges,fill=Churn))

Histogram

#code snippet for histogramggplot(subset(telco.df, PhoneService %in% c("Yes") & InternetService %in% c("DSL"," Fiber optic")),aes(x = MonthlyCharges, fill = Churn)) + geom_histogram()

5. Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
thejasmine

thejasmine

29 Followers

📍San Francisco, CA| Business Analytics | Strategy | Payments | https://thejasminehuang.com