-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall-data-comparing.R
159 lines (118 loc) · 5.64 KB
/
all-data-comparing.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#all data
#######################################################################################
#scatterplot matrix - Support
library(readxl)
apriori <- read_excel("apriori_results_all - v01g.xlsx",
sheet = "Support Values")
View(apriori)
summary(apriori)
attach(apriori)
# load required library
library(ggplot2)
# create a data frame for the variables to be plotted
plotdata <- data.frame(Amazon_Support = apriori$Amazon_Support,
Apple_Support = apriori$Apple_Support,
Disney_Support = apriori$Disney_Support,
HBO_Support = apriori$HBO_Support,
Netflix_Support = apriori$Netflix_Support,
Paramount_Support = apriori$Paramount_Support)
library(car)
# select the columns to include in the scatterplot matrix
cols <- c("Amazon_Support", "Apple_Support", "Disney_Support",
"HBO_Support", "Netflix_Support", "Paramount_Support")
# create the scatterplot matrix
sp=scatterplotMatrix(apriori[cols], diagonal = "density")
# create a scatterplot matrix using ggplot2 for 2 streaming platforms
ggplot(plotdata,aes(x = Amazon_Support, y = Disney_Support)) +
geom_point() +
labs(x = "Amazon_Support", y = "Disney_Support") +
facet_grid(. ~ ., scales = "free")
###interactive##
library(ggplot2)
library(plotly)
# create a data frame for the variables to be plotted
plotdata <- data.frame(Amazon_Support = apriori$Amazon_Support,
Apple_Support = apriori$Apple_Support,
Disney_Support = apriori$Disney_Support,
HBO_Support = apriori$HBO_Support,
Netflix_Support = apriori$Netflix_Support,
Paramount_Support = apriori$Paramount_Support)
# create the scatterplot matrix using ggplot2
p <- ggplot(plotdata, aes(x = Amazon_Support, y = Disney_Support)) +
geom_point() +
labs(x = "Amazon_Support", y = "Disney_Support") +
facet_grid(. ~ ., scales = "free")
# convert the ggplot object to plotly
ggplotly(p)
# create the scatterplot matrix using car
sp <- scatterplotMatrix(apriori[cols], diagonal = "density")
sp <- scatterplotMatrix(apriori[cols], diagonal = "adaptiveDensity")
# convert the scatterplot matrix to plotly
ggplotly(sp)
install.packages("GGally")
library(GGally)
# create a data frame for the variables to be plotted
plotdata <- data.frame(Amazon_Support = apriori$Amazon_Support,
Apple_Support = apriori$Apple_Support,
Disney_Support = apriori$Disney_Support,
HBO_Support = apriori$HBO_Support,
Netflix_Support = apriori$Netflix_Support,
Paramount_Support = apriori$Paramount_Support)
# create the scatterplot matrix using GGally
ggpairs(plotdata)
###############################################################################################3
#scatterplot matrix - Confidence
library(readxl)
apriori<- read_excel("apriori_results_all - v01g.xlsx",
sheet = "Confidence Values")
View(apriori)
summary(apriori)
attach(apriori)
# load required library
library(ggplot2)
# create a data frame for the variables to be plotted
plotdata <- data.frame(Amazon_Confidence = apriori$Amazon_Confidence,
Apple_Confidence = apriori$Apple_Confidence,
Disney_Confidence = apriori$Disney_Confidence,
HBO_Confidence = apriori$HBO_Confidence,
Netflix_Confidence = apriori$Netflix_Confidence,
Paramount_Confidence = apriori$Paramount_Confidence)
# create a scatterplot matrix using ggplot2 for 2 streaming platforms
ggplot(plotdata, aes(x = Amazon_Confidence, y = Apple_Confidence)) +
geom_point() +
labs(x = "Amazon_Confidence", y = "Apple_Confidence") +
facet_grid(. ~ ., scales = "free")
library(car)
# read the data
apriori <- read_excel("apriori_results_all - v01g.xlsx", sheet = "Confidence Values")
# select the columns to include in the scatterplot matrix
cols <- c("Amazon_Confidence", "Apple_Confidence", "Disney_Confidence",
"HBO_Confidence", "Netflix_Confidence", "Paramount_Confidence")
# create the scatterplot matrix
scatterplotMatrix(apriori[cols], diagonal = "density")
# create a data frame for the variables to be plotted
plotdata <- data.frame(Amazon_Confidence = apriori$Amazon_Confidence,
Apple_Confidence = apriori$Apple_Confidence,
Disney_Confidence = apriori$Disney_Confidence,
HBO_Confidence = apriori$HBO_Confidence,
Netflix_Confidence = apriori$Netflix_Confidence,
Paramount_Confidence = apriori$Paramount_Confidence)
p <- ggplot(plotdata, aes(x = Disney_Confidence, y = HBO_Confidence)) +
geom_point() +
labs(x = "Disney_Confidence", y = "HBO_Confidence") +
facet_grid(. ~ ., scales = "free")
# convert the ggplot object to plotly
ggplotly(p)
# create the scatterplot matrix using GGally
ggpairs(plotdata)
######################################################################################
#parallel coordinates plot
library(GGally)
# convert the summary table to a dataframe
df <- as.data.frame(t(apriori[-1]))
# set the row names as a column in the dataframe
df$Platform <- row.names(df)
# remove any missing values
df <- na.omit(df)
# create the parallel coordinates plot
ggparcoord(df, columns = 1:6, groupColumn = "Platform", alphaLines = 0.5)