Skip to content

Instantly share code, notes, and snippets.

View RJHKnight's full-sized avatar

Richard Knight RJHKnight

View GitHub Profile
@RJHKnight
RJHKnight / logging.R
Created February 21, 2022 00:34
R Logging util functions
# Logging -----------------------------------------------------------------
get_file_logger <- function()
{
if (! exists("file_logger"))
{
# File name
log_location <- config::get("log_file_location")
date_string <- format(today(), "%Y-%m-%d")
@RJHKnight
RJHKnight / mutliple_lags.R
Last active January 12, 2023 16:50
Example of creating multiple lags with dplyr
library(dplyr)
d <- data_frame(x = seq_len(100))
lag_fn <- list()
lags <- 1:10
for(i in lags) {
fixer <- function(x, i) {