CASE
WHEN REGEXP_MATCH(Page,"((?i).^/blog).") THEN "Blog"
WHEN REGEXP_MATCH(Page,"((?i).^/contact).") THEN "Contact"
ELSE "Other"
END
#visualize in ggplot | |
ggplot(R1, aes(channel_name, value, fill = variable)) + | |
geom_bar(stat='identity', position='dodge') + | |
ggtitle('TOTAL CONVERSIONS') + | |
theme(axis.title.x = element_text(vjust = -2)) + | |
theme(axis.title.y = element_text(vjust = +2)) + | |
theme(title = element_text(size = 16)) + | |
theme(plot.title=element_text(size = 20)) + | |
ylab("") |
translation <- | |
gl_translate( | |
data$comments, | |
target = "en", | |
format = c("text"), | |
source = "") |
library(googleAnalyticsR) | |
ga_auth(json_file = "C:\\folder-where-your-json-is-located\\service-key.json") | |
account_list$viewId | |
#pls change id | |
id <- 1234567 | |
data <- google_analytics(id, | |
date_range = c("2021-01-01","2021-05-02"), | |
metrics=c("sessions","bounceRate", |
#install.packages("plotly") | |
library(plotly) | |
plot(rules,engine="plotly") |
#https://github.com/mhahsler/arulesViz#standard-visualization | |
#install.packages("shiny") | |
library(shiny) | |
#install.packages("shinythemes") | |
library(shinythemes) | |
rules <- apriori(tr, parameter = list(support = 0.02, confidence = 0.02)) | |
ruleExplorer(rules) |
CASE
WHEN REGEXP_MATCH(Page,"((?i).^/blog).") THEN "Blog"
WHEN REGEXP_MATCH(Page,"((?i).^/contact).") THEN "Contact"
ELSE "Other"
END
#pull data from GA API | |
library(googleAnalyticsR) | |
#change location of json service key | |
ga_auth(json_file = "C:\\folder-where-your-service-creds-JSON-is-located\\json-service-key.json") | |
account_list$viewId | |
#change view id of | |
viewID <- 12345678 | |
data <- google_analytics( | |
viewID, | |
date_range = c("2020-01-01","2021-06-09"), |
#source R script | |
#https://thomas-neitmann.github.io/ggcharts/reference/pyramid_chart.html | |
library(googleAnalyticsR) | |
#pull data from GA API | |
library(googleAnalyticsR) | |
#change location of json service key | |
ga_auth(json_file = "C:\\secret-folder\\service-key.json") | |
account_list$viewId | |
#change view id | |
viewID <- 12345678 |
#creator of ggforce package: Thomas Lin Pedersen | |
#https://ggforce.data-imaginist.com/reference/geom_mark_hull.html | |
library(googleAnalyticsR) | |
ga_auth(json_file="C:\\location-of-your-json-file-folder\\service-key.json") | |
#update your view id | |
viewID <- 12345678 | |
data <- google_analytics( | |
viewID, | |
date_range=c("2019-01-01","2021-06-28"), |
# R TIPS ---- | |
# TIP 040 | Introduction to Modeltime: In Under 10-Minutes ---- | |
#By Matt Dancho, modeltime package creator | |
#R Tips newsletter by Matt Dancho: https://mailchi.mp/business-science/r-tips-newsletter | |
# LIBRARIES ---- | |
#installing packages from git | |
#install.packages("devtools") | |
library(devtools) | |
library(usethis) |