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
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 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 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 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 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 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 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 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> |
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
https://www.gastonsanchez.com/packyourcode/ |
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
sqlFetchData <- function(connection, database, schema, table, nobs = 'All') { | |
#'wrap function to fetch data from SQL Server | |
# | |
#@ connection: an established odbc connection | |
#@ database: database name | |
#@ schema: a schema under the main database | |
#@ table: the name of the data table to be fetched. | |
#@ nobs: number of observation to be fetched. Either 'All' or an integer number. | |
# The default value is 'All'. It also supports the input of 'all', 'ALL' and |