library(tidyverse)
lag_multiple <- function(x, n_vec){
map(n_vec, lag, x = x) %>%
set_names(paste0("lag", n_vec)) %>%
as_tibble()
}
tibble(x = 1:30) %>%
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(lubridate) | |
# Parse data from HH:MM:SS format into something that can be used by `lubridate` | |
hours %>% | |
separate(Duration, into = c("hours", "minutes", "seconds"), sep = ":", convert = TRUE) %>% | |
summarize(total_time = duration(hour = sum(hours), minute = sum(minutes), second = sum(seconds))) |
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(tidyverse) | |
library(broom) | |
US <- read_csv("https://raw.githubusercontent.com/nytimes/covid-19-data/master/us.csv") %>% | |
mutate(new_deaths = deaths - lag(deaths)) %>% | |
filter(date >= "2020-02-26") | |
models <- tibble(degrees = 2:4) %>% | |
mutate(model = map(degrees, ~ lm(log(new_deaths + 1) ~ poly(date, .), data = US))) |
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
import numpy as np | |
import tensorflow as tf | |
def dense(x, weights, bias, activation=tf.identity, **activation_kwargs): | |
"""Dense layer.""" | |
z = tf.matmul(x, weights) + bias | |
return activation(z, **activationn_kwargs) | |
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
(require '[clara.rules :as r]) | |
;;;; Define 3 rules, where the "priority" order is r1, r2, r3, where the highest priority is first | |
;;;; and the rest is in descending order of priority. | |
;;;; :type :rule/result "syntetic" fact is used to hold the final changes that can be queried out | |
;;;; from a session after `r/fire-rules` via `r/query` on the `find-results` query. | |
;;;; A namespace qualified keyword is used to avoid collision with externally given :type of | |
;;;; "real" facts. |
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
hi |
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
``` r | |
library(ggplot2) | |
library(dplyr) | |
library(magick) | |
library(patchwork) | |
library(gt) | |
library(ggtext) | |
mtcars %>% | |
head() %>% |
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(ggplot2) | |
library(dplyr) | |
library(tibble) | |
library(tidyr) | |
GeomVector <- ggproto("GeomVector", Geom, | |
required_aes = c("x", "y", "direction", "length"), | |
default_aes = aes( |
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(rmarkdown) | |
library(knitr) | |
render("eqn-numbering.Rmd") |
Hello all.
This is A Very Long and Boring Email Text File about File Versioning and Servers.
Please feel free to point and laugh, but this is all stuff that I've learnt the hard way, and that we should start to do as we get bigger. It doesn't take long for all this to become a habit; something you don't even think about doing. When it's working properly, it offloads a load of organisational stuff from your brain, too - which is nice, and what computers should help you do.
OlderNewer