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: "Stop learnr tutorial with a button" | |
output: learnr::tutorial | |
runtime: shiny_prerendered | |
--- | |
```{r setup, include=FALSE} | |
library(learnr) | |
knitr::opts_chunk$set(echo = FALSE) | |
``` |
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
# Create a new RStudio package project in a directory of your choice | |
# We'll assume it's called, "mypkg" | |
# Check "Create a git repository" if you use git! | |
# Packages we'll need | |
install.packages(c( | |
"devtools", | |
"usethis", | |
"roxygen2", | |
"testthat" |
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
# Sometimes during repeat calls to a function, it may be helpful if arguments used in a | |
# previous call are passed as a list to the function in subsequent calls, to be | |
# superseded if individual arguments of the same name are given. | |
# | |
# The following function prioritises specified arguments (including ... arguments) over an | |
# argument list, and the argument list over default values. | |
handle_args <- function(arg1 = 1, arg2 = 2, arglist = list(), ...) { | |
# Copy default arguments |
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(mgcv) | |
library(ggplot2) | |
# Download | |
c19 <- readr::read_csv("https://coronavirus.data.gov.uk/downloads/csv/coronavirus-cases_latest.csv") | |
# Extract case counts for England and select useful variables | |
c19_Eng <- c19 %>% filter(`Area type` == "nation") %>% | |
transmute(date = `Specimen date`, cases = `Daily lab-confirmed cases`) |