- Eurostat, World Bank and others: https://ikashnitsky.github.io/2017/data-acquisition-two/
- Star Wars data: in dplyr, http://dplyr.tidyverse.org/reference/starwars.html
- Baby names data: babynames package, https://cran.r-project.org/web/packages/babynames/index.html
- Movies data: https://cran.r-project.org/web/packages/ggplot2movies/index.html ggplot2movies package
- Game of Thrones screen time: https://github.com/Preetish/GoT_screen_time
- Open Bike Data: https://github.com/ropensci/bikedata
- Tons of data through 538: https://cran.r-project.org/web/packages/fivethirtyeight/vignettes/fivethirtyeight.html
- Public health data England: fingertipsR, https://cran.r-project.org/web/packages/fingertipsR/
- Financial data via Quandl: https://www.quandl.com/tools/r
- Cyclones: https://github.com/ropensci/rrricanesdat
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 'securerandom' | |
class NameGenerator | |
LEFT = [ | |
"admiring", | |
"adoring", | |
"affectionate", | |
"agitated", | |
"amazing", | |
"angry", |
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) | |
## approximates big_df in the post | |
big_df <- mtcars %>% | |
select(cyl, mpg, disp) %>% | |
arrange(cyl) %>% | |
slice(17:22) %>% | |
rename(ID = cyl) | |
## dummy function that needs access to ID and data |
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
snippet bdfig | |
Figure \@ref(fig:${1:chunk-name}) ${0} | |
(ref:${1:chunk-name}) Text reference for caption | |
```{r ${1:chunk-name}, fig.cap = "(ref:${1:chunk-name})"} | |
``` |
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(httr) | |
library(magick) | |
library(hrbrthemes) | |
library(ggplot2) | |
theme_tweet_rc <- function(grid = "XY", style = c("stream", "card"), retina=TRUE) { | |
style <- match.arg(tolower(style), c("stream", "card")) | |
switch( |
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
download.file("https://ndownloader.figshare.com/articles/5170705/versions/1", "kd.zip") | |
unzip("kd.zip") | |
library(readr) | |
words <- readr::read_csv("KSP-Word.csv") | |
users <- readr::read_csv("KSP-User.csv") | |
entries <- readr::read_csv("KSP-Entry.csv") | |
keypress <- readr::read_csv("KSP-KeyPress.csv") | |
pressure <- readr::read_csv("KSP-Pressure.csv") |
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
# WMF only: | |
if (file.exists("/etc/wikimedia-cluster")) { | |
message('Detected that this script is being run on a WMF machine ("', Sys.info()["nodename"], '"). Setting proxies...') | |
Sys.setenv("http_proxy" = "http://webproxy.eqiad.wmnet:8080") | |
Sys.setenv("https_proxy" = "http://webproxy.eqiad.wmnet:8080") | |
} | |
# General use: | |
message("Checking for a personal library...") | |
if (!dir.exists(Sys.getenv("R_LIBS_USER"))) { |
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(magick) | |
library(magrittr) | |
# Convert to 'ico' format | |
image_read("https://www.r-project.org/logo/Rlogo.png") %>% | |
image_scale("32x32!") %>% # remove the "!" after 32x32 to scale proportionally | |
image_write("favicon.ico", format = "ico") | |
# Favicon can also be png/gif |
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
games.howell <- function(grp, obs) { | |
#Create combinations | |
combs <- combn(unique(grp), 2) | |
# Statistics that will be used throughout the calculations: | |
# n = sample size of each group | |
# groups = number of groups in data | |
# Mean = means of each group sample | |
# std = variance of each group sample |
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
county | sample | state | name | exceedances | |
---|---|---|---|---|---|
Mobile | 20 | al | Dauphin Island Water & Sewer | 1 | |
Monroe | 23 | al | Excel Water System | 1 | |
Washington | 95 | al | Tate & Lyle Sucralose, Inc. Water System | 1 | |
Coosa | 18.3 | al | Lake Mitchell Water, Incorporated | 1 | |
Juneau City and Borough | 15.5 | ak | Thunder Mountain Mobile Park | 1 | |
Juneau City and Borough | 31 | ak | Hecla Greens Creek Hawk Inlet | 1 | |
Ketchikan Gateway Borough | 27.7 | ak | Boyer Towing | 1 | |
Ketchikan Gateway Borough | 32.9 | ak | Thorne Bay, City Of | 1 | |
Ketchikan Gateway Borough | 16.2 | ak | Clover Pass Christian School | 2 |