-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunStudy.R
More file actions
66 lines (43 loc) · 1.92 KB
/
Copy pathRunStudy.R
File metadata and controls
66 lines (43 loc) · 1.92 KB
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
# Project Name: DASHBOARD FOR WEB ANALYTICS INSIGHTS:
rm(list = ls( ))
######################################################################
# THESE ARE THE PROJECT PARAMETERS NEEDED TO GENERATE THE REPORT
# When running the case on a local computer, modify this in case you saved the files in a different directory
# set local directory in R to folder with the following downloaded files (server.R, ui.R, data, doc and my_app folders)
################################################
# Now run (source) everything below this line
#clears current working enviroment.
rm(list = ls( ))
#this loads the R packages neeeded
install.packages("shiny")
install.packages("googlevis")
install.packages("devtools")
library(shiny)
library(googleVis)
library(devtools)
# this loads the data files: DO NOT EDIT THIS LINE
bubble_data=read.csv("data/R_Data_Bubble.csv", header = T, sep = ",")
country_data=read.csv("data/R_Data_Country.csv", header = T, sep = ",")
table_data=read.csv("data/R_Data_Table.csv", header = T, sep = ",")
# this reconstructs the data files to develop the charts
#Reconstruct - VISITS
visits<-head(bubble_data,-1)
colnames(visits)<- tolower(colnames(visits))
str(visits)
colnames(visits)<- c("medium", "deviceCategory", "sessions", "viewspersession", "revenuepertransaction" )
visits$sessions <- as.numeric(visits$sessions)
visits$viewspersession <- as.numeric(visits$viewspersession)
visits$revenuepertransaction <- as.numeric(visits$revenuepertransaction)
#Reconstruct - GeoMap
countries<-head(country_data,-1)
colnames(countries)<- c("deviceCategory", "country","ga.users", "users")
countries$users <- as.numeric(as.character(countries$users))
#Reconstruct - TABLE
tables<-head(table_data,-1)
colnames(tables)<- tolower(colnames(tables))
str(tables)
colnames(tables)<- c("Region", "Users", "Percent")
tables$Users <- as.numeric(tables$Users)
tables$Percent <- as.numeric(tables$Percent)
# now run the app
runApp("my_app")