Sameer Mathur
Data Summary and Tables
library(ISLR)
library(data.table)
# reading data
pChurn.dt <- fread("2019CleanChurnData.csv")
attach(pChurn.dt)
# dimension of the dataset
dim(pChurn.dt)
[1] 6347 13
# names of the data columns
colnames(pChurn.dt)
[1] "ID" "Age"
[3] "Churn" "CHIDec"
[5] "CHIChange" "SupportCasesDec"
[7] "SupportCasesChange" "SupportPriorityDec"
[9] "SupportPriorityChange" "LoginsChange"
[11] "BlogPostsChange" "ViewsChange"
[13] "DaysSinceLoginChange"
# structure of the data table
str(pChurn.dt)
Classes 'data.table' and 'data.frame': 6347 obs. of 13 variables:
$ ID : int 1 1112 2223 3334 4445 5556 6015 6126 6237 1002 ...
$ Age : int 58 58 52 57 54 55 54 42 53 53 ...
$ Churn : chr "No" "No" "No" "No" ...
$ CHIDec : int 1 223 1 149 202 45 92 21 240 240 ...
$ CHIChange : int 1 179 1 95 2 3 53 8 75 39 ...
$ SupportCasesDec : int 1 1 1 2 1 1 2 1 2 1 ...
$ SupportCasesChange : int 1 1 1 2 1 1 20 1 11 1 ...
$ SupportPriorityDec : int 1 1 1 11 1 1 11 1 11 1 ...
$ SupportPriorityChange: int 1 1 1 1 1 1 42 1 1 1 ...
$ LoginsChange : int 1 1 1 152 1 228 120 1 84 72 ...
$ BlogPostsChange : int 1 1 1 23 1 1 2 1 25 1 ...
$ ViewsChange : int 1 145 1 887 1331 319 1334 1044 1 989 ...
$ DaysSinceLoginChange : int 134 134 134 1 134 1 1 139 141 115 ...
- attr(*, ".internal.selfref")=<externalptr>
# convert 'Churn' as a factor
pChurn.dt[, Churn := factor(Churn)]
# varifying conversion
str(pChurn.dt$Churn)
Factor w/ 2 levels "No","Yes": 1 1 1 1 1 1 1 1 1 1 ...
# descriptive statistics of the dataframe
library(psych)
describe(pChurn.dt)[, c(1:5)]
vars n mean sd median
ID 1 6347 3174.00 1832.37 3174
Age 2 6347 24.50 19.65 18
Churn* 3 6347 1.05 0.22 1
CHIDec 4 6347 103.14 92.67 73
CHIChange 5 6347 80.39 77.91 49
SupportCasesDec 6 6347 3.03 4.66 1
SupportCasesChange 7 6347 6.42 9.51 1
SupportPriorityDec 8 6347 3.60 4.36 1
SupportPriorityChange 9 6347 8.79 14.09 1
LoginsChange 10 6347 115.91 98.90 98
BlogPostsChange 11 6347 9.94 14.70 1
ViewsChange 12 6347 471.71 450.25 372
DaysSinceLoginChange 13 6347 52.80 58.47 11
Churn
No Yes
94.91 5.09
Churn AvgAge
1: No 24.68
2: Yes 21.20
Churn AvgCHIDec AvgCHIChange
1: No 102.92 81.16
2: Yes 107.16 66.07
Churn AvgSupportCasesDec AvgSupportCasesChange
1: No 3.08 6.52
2: Yes 2.12 4.59
Churn AvgSupportPriorityDec AvgSupportPriorityChange
1: No 3.66 8.87
2: Yes 2.60 7.44
LoginChange
BlogPostChange
ViewsChange
DaysSinceLoginChange