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
//Remove All Empty Columns in the Entire Workbook | |
function removeEmptyColumns() { | |
var ss = SpreadsheetApp.getActive(); | |
var allsheets = ss.getSheets(); | |
for (var s in allsheets){ | |
var sheet=allsheets[s] | |
var maxColumns = sheet.getMaxColumns(); | |
var lastColumn = sheet.getLastColumn(); | |
if (maxColumns-lastColumn != 0){ | |
sheet.deleteColumns(lastColumn+1, maxColumns-lastColumn); |
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\\export_sleep.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
library(googleAnalyticsR) | |
library(ggplot2) | |
library(dplyr) | |
#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 my_accounts 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()) |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright 2012 Google Inc. All Rights Reserved. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 |
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(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
{ | |
"reportDescription":{ | |
"source": "realtime", | |
"reportSuiteID":"rtd-example", | |
"metrics":[ | |
{"id":"pageviews"} | |
], | |
"elements": [ | |
{ | |
"id": "page", |