Skip to content

Instantly share code, notes, and snippets.

View Tadge-Analytics's full-sized avatar

Julian Tagell Tadge-Analytics

View GitHub Profile
# https://developer.xero.com/documentation/guides/oauth2/auth-flow/
# https://developer.xero.com/app/manage/
# credentials presented in this script are no longer valid
# Xero app has been deleted
# there are more secure ways of storing credentials in R...
# I have demonstrated the least secure way, just so that the script is more readible.
library(tidyverse)
my_penguins_plot <-
palmerpenguins::penguins %>%
filter(!is.na(sex)) %>%
ggplot() +
aes(bill_length_mm, body_mass_g, col = species) +
geom_point(size = 5, alpha = 0.85) +
###################################################################
folder_path <- "diamond csv storage"
csv_file_path <- paste0(folder_path, "/diamonds.csv")
xlsx_file_path <- paste0(folder_path, "/diamonds.xlsx")
###################################################################
# Input data
# Create the Employment Range field which captures the employees full tenure at the company in the MMM yyyy to MMM yyyy format.
# Work out for each year employed per person:
# Number of months they worked
# Their salary they will have received
# Their sales total for the year
# For each Reporting Year (the individual year someone worked for us), calculate their cumulative months (called Tenure)
library(tidyverse)
library(readxl)
###################################################################
import <-
read_excel("PD 2021 Wk 48 Input.xlsx", col_names = F) %>%
library(tidyverse)
library(readxl)
###################################################################
path_to_workbook <- "top_female_poker_players_and_events.xlsx"
workbook_sheets <- excel_sheets(path_to_workbook)
library(tidyverse)
import <- read_csv("original data/train_users.csv")
intro_month <- as.Date("2013-12-01")
set.seed(123)
tidy <- import %>%
filter(lubridate::year(date_account_created) >= 2013) %>%
//Current month start date
DATETRUNC("month", [Reference date formula])
//Prev month start date
DATEADD("month", -1, [Current month start date])
library(tidyverse)
library(rvest)
google_scholar_urls <- tibble::tribble(
~name, ~url_path,
"Tim Capon", "https://scholar.google.com/citations?user=mJeSBzAAAAAJ&hl=en",
"Céline Nauges", "https://scholar.google.com/citations?hl=en&user=ehxgHeQAAAAJ",
"Stéphane De Cara", "https://scholar.google.com/citations?hl=en&user=OjOkZwEAAAAJ",
"Israel Finkelshtain", "https://scholar.google.com/citations?hl=en&user=ZBlt4VgAAAAJ",
library(tidyverse)
library(lubridate)
actuals <- seq.Date(today() - 400, today(), "day") %>%
tibble(Date = .) %>%
crossing(
`Reporting Level 1` = paste0("Level 1_", LETTERS[1:3]),
`Reporting Level 2` = paste0("Level 2_", LETTERS[1:3]),
`Reporting Level 3` = paste0("Level 3_", LETTERS[1:4]),