This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
library(lubridate) | |
#load steps data into data frame | |
dfsteps <- read.csv("C:\\Users\\praskry\\Desktop\\apple_health_data\\StepCount.csv") | |
str(dfsteps) | |
#make endDate in a date time variable POSIXct using lubridate with eastern time zone | |
dfsteps$endDate <-ymd_hms(dfsteps$endDate,tz="America/New_York") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(ggplot2) | |
library(lubridate) | |
library(XML) | |
#load apple health export.xml file | |
xml <- xmlParse("C:\\Users\\praskry\\Desktop\\apple_health_data\\export.xml") | |
#transform xml file to data frame - select the Record rows from the xml file | |
df <- XML:::xmlAttrsToDataFrame(xml["//Record"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"real_time_settings":[ | |
{ | |
"metric":"instances", | |
"elements":[ | |
"page", "sitesection", "referringdomain" | |
], | |
"min_granularity":"1", | |
"name":"Content Real Time Report", | |
"ui_report":"true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"reportDescription":{ | |
"source": "realtime", | |
"reportSuiteID":"rtd-example", | |
"metrics":[ | |
{"id":"pageviews"} | |
], | |
"elements": [ | |
{ | |
"id": "page", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googleAnalyticsR) | |
library(tidyr) | |
#Authorized Google Analytics R- this will open a webpage | |
#You must be logged into your Google Analytics account on your web browser | |
ga_auth() | |
#Use the Google Analytics Management API to see a list of Google Analytics accounts you have access to | |
my_accounts <- google_analytics_account_list() | |
View(my_accounts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## filter pivot results | |
pivot_dim_filter1 <- dim_filter("eventLabel", | |
"REGEXP", | |
"%|#disqus") | |
pivot_dim_clause <- filter_clause_ga4(list(pivot_dim_filter1)) | |
pivme <- pivot_ga4("eventLabel", | |
metrics = c("totalEvents"), | |
maxGroupCount = 5, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googleAnalyticsR) | |
library(ggplot2) | |
#Authorize Google Analytics R- this will open a webpage | |
#You must be logged into your Google Analytics account on your web browser | |
ga_auth() | |
#Use the Google Analytics Management API to see a list of Google Analytics accounts you have access to | |
my_accounts <- google_analytics_account_list() | |
View(my_accounts) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googleAnalyticsR) | |
library(ggplot2) | |
#Authorized Google Analytics R- this will open a webpage | |
#You must be logged into your Google Analytics account on your web browser | |
ga_auth() | |
#Make sure to replace this with your viewId. You can use google_analytics_account_list() to find your viewId. | |
my_id <- 94579701 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(googleAnalyticsR) | |
library(ggplot2) | |
#Authorized Google Analytics R- this will open a webpage | |
#You must be logged into your Google Analytics account on your web browser | |
ga_auth() | |
#Use google_analytics_account_list() to find the viewId. Make sure to replace this with your viewId. | |
my_id <- 94579701 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
df <- read.csv("C:/Users/praskry/Desktop/more_than_1.csv", header = TRUE) | |
df %>% summarize(UVs = n_distinct(Visitor_ID)) #unique visitor count | |
df1 <-filter(df, grepl('shoes|socks',Pages)) #filter to only include prod pages | |
df2 <-df1 %>% group_by(Visitor_ID) %>% filter(n()>1) | |
df3<-df2 %>% group_by(Visitor_ID) %>% summarize(count=n()) | |
df3 %>% group_by(count) %>% summarize(total.count=n()) |