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 |
## Using position_nudge() to make showing a background | |
## distribution a little nicer, by pushing it very slightly | |
## to the right. Most of the work is getting the penguins | |
## data to the point where I can demonstrate position_nudge() | |
library(tidyverse) | |
library(palmerpenguins) | |
# Classify every penguin's flipper length into | |
# bins with widths of 10mm; then sum up |
```{r} | |
library(tidyverse) | |
library(here) | |
library(fs) | |
library(socviz) | |
``` | |
```{r} | |
here() | |
``` |
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)) | |
) |