This is an R Markdown document.
A brief analysis has been performed on the data procured and documented as an R Markdown document.
library(xlsx)
## Loading required package: rJava
## Loading required package: xlsxjars
data11 <- read.xlsx("SampleData.xlsx", sheetName = "SampleData1", header = TRUE)
data22 <- read.xlsx("SampleData.xlsx", sheetName = "SampleData2", header = TRUE)
data2 = data22[complete.cases(data22),]
data1 = data11[complete.cases(data11),]
data1$User = NA
data2$User <- as.character(data2$User)
for(i in data1[,1])
{
for(q in data2[,1])
{
if(data1$Id[i] == data2$Id[q])
{
data1$User[i] = data2$User[q]
}
}
}
data.1 = data1[complete.cases(data1),]
summary(data1)
## NA. Id Type Date
## Min. : 1.00 Min. :10121 Call : 7 Min. :2016-08-04 10:16:47
## 1st Qu.:15.75 1st Qu.:10137 Email :18 1st Qu.:2016-08-04 15:18:37
## Median :30.50 Median :10152 NA : 1 Median :2016-08-04 16:23:55
## Mean :31.00 Mean :10158 Update:37 Mean :2016-08-04 15:33:30
## 3rd Qu.:46.25 3rd Qu.:10168 Visit : 1 3rd Qu.:2016-08-04 17:05:38
## Max. :62.00 Max. :10219 Max. :2016-08-04 19:04:15
##
## CountA CountB CountC FeedBack
## Min. :0.0367 Min. :0.0005537 Min. :0.001932 Others :27
## 1st Qu.:0.2371 1st Qu.:0.2111432 1st Qu.:0.344485 NC :15
## Median :0.4064 Median :0.4650753 Median :0.427289 nc :13
## Mean :0.4813 Mean :0.4897665 Mean :0.477077 NA : 2
## 3rd Qu.:0.7218 3rd Qu.:0.8149653 3rd Qu.:0.709689 Undecided: 2
## Max. :0.9802 Max. :0.9840489 Max. :0.966656 UNDECIDED: 2
## (Other) : 3
## User
## Length:64
## Class :character
## Mode :character
##
##
##
##
newd <- table(data1$Type, data1$User)
net = as.data.frame.matrix(newd)
net$Total = net$A1001 + net$A1002 + net$A1003 + net$A1004 + net$A1005
print(net)
## A1001 A1002 A1003 A1004 A1005 Total
## Call 3 0 1 3 0 7
## Email 2 9 2 1 3 17
## NA 0 1 0 0 0 1
## Update 11 2 19 4 0 36
## Visit 1 0 0 0 0 1
makeProfilePlot <- function(mylist,names)
{
require(RColorBrewer)
# find out how many variables we want to include
numvariables <- length(mylist)
# choose 'numvariables' random colours
colours <- brewer.pal(numvariables,"Set1")
# find out the minimum and maximum values of the variables:
mymin <- 1e+20
mymax <- 1e-20
for (i in 1:numvariables)
{
vectori <- mylist[[i]]
mini <- min(vectori)
maxi <- max(vectori)
if (mini < mymin) { mymin <- mini }
if (maxi > mymax) { mymax <- maxi }
}
# plot the variables
for (i in 1:numvariables)
{
vectori <- mylist[[i]]
namei <- names[i]
colouri <- colours[i]
if (i == 1) { plot(vectori,col=colouri,type="l",ylim=c(mymin,mymax)) }
else { points(vectori, col=colouri,type="l") }
lastxval <- length(vectori)
lastyval <- vectori[length(vectori)]
text((lastxval-10),(lastyval),namei,col="black",cex=0.6)
}
}
library(RColorBrewer)
names <- c("A1001", "A1002", "A1003", "A1004", "A1005")
mylist <- list(net$A1001, net$A1002, net$A1003, net$A1004, net$A1005)
makeProfilePlot(mylist,names)
legend("topright", c("A1001", "A1002", "A1003", "A1004", "A1005"), cex = 1.0, fill = rainbow(length(net$A1001)))
print(net)
## A1001 A1002 A1003 A1004 A1005 Total
## Call 3 0 1 3 0 7
## Email 2 9 2 1 3 17
## NA 0 1 0 0 0 1
## Update 11 2 19 4 0 36
## Visit 1 0 0 0 0 1
Thank You