show dbs
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
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# | |
# ##### ### # ##### | |
# # # # # # # # # | |
# # # # # # # # | |
# ##### # # # # ##### | |
# # # # ####### # # | |
# # # # # # # | |
# ####### ### # ##### |
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
gen_plot <- function(xvals = c(1,12), yvals = c(1,10), n = 10, | |
distance = seq(-3,3,length.out =n), | |
seed = NULL, palette = c("red", "blue")){ | |
# adapted from: https://stackoverflow.com/questions/50275195/ | |
segment.shift <- function(x1,x2,y1,y2, d){ | |
# calculate vector | |
v <- c(x2 - x1,y2 - y1) | |
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
--- | |
title: "Fancy math" | |
output: | |
html_document: default | |
pdf_document: default | |
--- | |
```{r setup, include=FALSE} | |
# Conditional tikz output types; use PDF if this is LaTeX, otherwise use a | |
# shrunken down high resolution PNG |
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(shiny) | |
xy <- c(784,479) #output of grDevices::dev.size("px") | |
url <- "https://www.youtube.com/watch?v=Ef2jmf2vy00" #copy yt link here | |
url <- gsub("watch\\?v=","embed/",url) | |
ui <- fluidPage( | |
HTML(paste0('<iframe width="',xy[1],'" height="',xy[2],'" src="',url,'" frameborder="0"></iframe>')) | |
) | |
server <- function(input, output, session) { | |
} |
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
# Data available here | |
# https://www.ons.gov.uk/file?uri=/peoplepopulationandcommunity/birthsdeathsandmarriages/livebirths/adhocs/009010babynames1996to2017englandandwales/adhocallbabynames1996to2017.xls | |
library(tidyverse) | |
library(readxl) | |
rank_names <- map_chr(2017:1996, paste0, "-rank") | |
count_names <- map_chr(2017:1996, paste0, "-count") | |
cnames <- c(rank_names, count_names) %>% sort(decreasing = TRUE) |