This file contains hidden or 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(tidyverse) | |
| library(lubridate) | |
| ## each id is a person, and each row is one episode | |
| ## the two episode for id 1 overlap! | |
| example_dates <- tibble( | |
| id = c(1,1,2,2), | |
| date_start = ymd(c("2020-01-01", "2020-01-03","2020-04-01", "2020-04-15")), | |
| date_end = ymd(c("2020-01-05", "2020-01-10", "2020-04-04", "2020-04-16")) | |
| ) #%>% |
This file contains hidden or 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(data.table) | |
| library(ggplot2) | |
| library(cusumcharter) | |
| library(purrr) | |
| library(tidyr) | |
| library(ggExtra) | |
| # make the link dynamic |
This file contains hidden or 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
| ndays <- 7 | |
| ndays_sql <- ndays * -1 | |
| con <- DBI::dbConnect(odbc::odbc(), | |
| Driver = "SQL Server", | |
| Server = "SERVER", | |
| Database = "TABLE", | |
| Trusted_Connection = "True", | |
| Port = 1433) | |
This file contains hidden or 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(data.table) | |
| ?`[.data.table` | |
| DT <- data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9) | |
| X <- data.table(x=c("c","b"), v=8:7, foo=c(4,2)) | |
| colnames(DT) | |
| # [1] "x" "y" "v" |
This file contains hidden or 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
| ---- | |
| Power BI Official Software - Cost: $0 Dimes | |
| ---- | |
| Power BI Desktop. From the Microsoft Store updates automatically. #WINNING | |
| URL: https://aka.ms/pbidesktopstore | |
| Power BI Desktop. From download center requires manual updating. #NOTWINNING |
This file contains hidden or 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(lubridate) | |
| library(dplyr) | |
| library(tidyr) | |
| library(readxl) | |
| library(purrr) | |
| library(here) | |
| setwd(here("2021-04")) | |
| wb <- "PD 2021 Wk 4 Input.xlsx" |
This file contains hidden or 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(lubridate) | |
| library(dplyr) | |
| library(tidyr) | |
| library(readxl) | |
| library(purrr) | |
| library(here) | |
| setwd(here("2021-03")) | |
This file contains hidden or 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(here) | |
| library(data.table) | |
| library(stringr) | |
| setwd(here("2021-02")) | |
| # read in and process | |
| DT <- fread('Input.csv') |
This file contains hidden or 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(data.table) | |
| library(gsheet) | |
| library(ggplot2) | |
| link <- 'https://docs.google.com/spreadsheets/d/1GYv4573GnJa-C21NYeDj-OhFSTwrK0SnQNF2IQFqa50/edit#gid=0' | |
| import <- gsheet2text(link, format = 'tsv') | |
| DT <- fread(import) | |
| DT[, Date := as.IDate(DT$Date, format = "%d/%m/%Y")] |
This file contains hidden or 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
| <script>document.write(new Date().getFullYear())</script> | |
| or | |
| <script>new Date().getFullYear()>2005&&document.write("-"+new Date().getFullYear());</script> |