Command Flags
Flag | Options | Description |
---|---|---|
-codec:a |
libfaac, libfdk_aac, libvorbis | Audio Codec |
-quality |
best, good, realtime | Video Quality |
-b:a |
128k, 192k, 256k, 320k | Audio Bitrate |
-codec:v |
mpeg4, libx264, libvpx-vp9 | Video Codec |
library(tidyverse) | |
library(babynames) | |
babynames %>% | |
filter(sex == "M") %>% | |
mutate(endletter = str_sub(name, -1)) %>% | |
group_by(year, endletter) %>% | |
summarize(letter_count = n()) %>% | |
mutate(letter_prop = letter_count / sum(letter_count), | |
letter_rc = case_when( |
## Context: https://twitter.com/grant_mcdermott/status/1493400952878952448 | |
options(collapse_mask = "all") # NB: see `help('collapse-options')` | |
library(dplyr) | |
library(data.table) | |
library(collapse) # Needs to come after library(dplyr) for collapse_mask to work | |
flights = fread('https://raw.githubusercontent.com/Rdatatable/data.table/master/vignettes/flights14.csv') |
library(tidyverse) | |
library(cowplot) | |
df <- read_csv("https://osf.io/qmhgw/download") | |
out <- df %>% | |
ggplot(mapping = aes(x = year, | |
y = oneper, | |
group = country, | |
color = Region)) + |
# UK map v. quick example | |
## Libraries | |
library(tidyverse) | |
library(sf) | |
#> Linking to GEOS 3.8.1, GDAL 3.1.4, PROJ 6.3.1 | |
## Get the map data |
Command Flags
Flag | Options | Description |
---|---|---|
-codec:a |
libfaac, libfdk_aac, libvorbis | Audio Codec |
-quality |
best, good, realtime | Video Quality |
-b:a |
128k, 192k, 256k, 320k | Audio Bitrate |
-codec:v |
mpeg4, libx264, libvpx-vp9 | Video Codec |
library(tidyverse) | |
library(gapminder) | |
library(ggalt) ## install with install.packages("ggalt", repos = "http://cran.rstudio.com") | |
## Make some sample data with three countries that each has nine measures | |
example_wide <- gapminder %>% | |
select(country, year, lifeExp, pop, gdpPercap) %>% | |
filter(country %in% c("United States", "Canada", "Mexico"), | |
year %in% c(1957, 1977, 2007)) %>% | |
pivot_wider(names_from = year, values_from = lifeExp:gdpPercap) |
## Get current Apple COVID data | |
## Kieran Healy / @kjhealy | |
## E.g. apple_covid <- get_apple_data() | |
## 1. Find today's URL | |
## Thanks to David Cabo (@dcabo) for alerting me to the existence of the json file. | |
get_apple_target <- function(cdn_url = "https://covid19-static.cdn-apple.com", | |
json_file = "covid19-mobility-data/current/v3/index.json") { | |
tf <- tempfile(fileext = ".json") |
library(dplyr, warn.conflicts = FALSE) | |
library(gapminder) | |
probs <- c(0.1, 0.5, 0.9) | |
gapminder %>% | |
group_by(continent) %>% | |
summarise( | |
probs = probs, | |
across(is.numeric & !year, ~ quantile(.x, probs)) | |
) |
# pkgs | |
pacman::p_load(tidyverse, polite, scales, ggimage, ggforce, | |
rvest, glue, extrafont, ggrepel, magick) | |
loadfonts() | |
## add_logo function from Thomas Mock | |
add_logo <- function(plot_path, logo_path, logo_position, logo_scale = 10){ | |
# Requires magick R Package https://github.com/ropensci/magick |
## Start with the code in https://github.com/kjhealy/lexis_surface/blob/master/lexis.r | |
## At the bottom, the `fra_surface` object is done in 3D with the `plotly` library. We can | |
## also do it with `rayshade`: | |
library(rayshader) | |
## rayshade wants the axes a little differently from plotly | |
## but like plotly it wants a matrix. | |
fra_surf <- fra_surf[c(1:201),c(100:1)] |