This file contains hidden or 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) | |
library(sf) | |
library(googlesheets4) | |
# get our data from google sheets, we need to: | |
# - 'publish to web' | |
# - adjust sharing settings to share with anyone | |
# I've done these, now, so it should just work: | |
my_key <- "1xUqRGnb9kwBi128cERiHkV5w4uREwl-mqAVf0jmQhhg" |
This file contains hidden or 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
# also at https://gist.github.com/benmarwick/f11ae49ab9afde0071b133012ff76cbc | |
ctv <- "https://raw.githubusercontent.com/benmarwick/ctv-archaeology/master/README.md" | |
library(tidyverse) | |
library(glue) | |
archy_ctv_readme <- readLines(ctv) | |
# get just the articles |
This file contains hidden or 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
# How to save a ggplot as a JPG file with a | |
# specific dpi and dimensions, for example, | |
# because a publisher requires it | |
library(ggplot2) | |
p <- | |
ggplot(mtcars) + | |
aes(mpg, | |
disp) + |
This file contains hidden or 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) | |
library(rvest) | |
# what quarter and year do we want to check for the availability of DSM courses? | |
qrt_year <- "AUT2020" | |
# this is the URL to our canonical list of DSM courses | |
webpage <- "https://www.washington.edu/uaa/advising/single-pages/data-science-minor/" |
This file contains hidden or 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
# from https://github.com/cboettig/compendium/blob/master/.github/workflows/main.yml | |
on: [push] | |
name: render all R Markdown documents | |
jobs: | |
render: | |
name: render all R Markdown documents | |
runs-on: macOS-latest | |
steps: |
This file contains hidden or 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
# another method | |
# remotes::install_github("ropenscilabs/reviewer") | |
browseURL(reviewer::diff_rmd("analysis/paper/paper.qmd", | |
# this gets the sha of the previous commit | |
git2r::commits(n=2)[[2]]$sha)$raw) |
This file contains hidden or 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
# paste from http://www.ceacb.ucl.ac.uk/ceacb_files/misc/Tehrani_Collard_2002.pdf | |
# edit to get each textile design on one line | |
raw_input <- | |
c("Ersari 1 0 1 0 1 1 0 1 0 1 1 0 1 1 100000011010000001011001111101011000011111100110111011011011011011110000000 0 | |
Saryk 1 0 1 0 1 1 1 1 1 1 1 0 1 0 100000011010111101010100001111100000010101010110011011100000001011100000000 0 | |
Salor 1 0 1 1 0 1 0 1 0 1 0 1 0 0 011110110101000001011000001011110111010101000100111101111101001101100000101 0 | |
PSDP Tekke 1 1 0 0 0 1 0 1 1 0 1 0 0 0 011000011111111111011010001010100000010101101101000000000000000000001101000 0 | |
SDP Tekke 1 1 0 0 0 1 0 1 1 0 0 1 0 0 000011111001110011111010000000000010100001100000000000001100101010001011111 1 | |
Yomut 0 0 0 0 0 1 0 1 1 0 0 0 1 1 000000000000101100000001100000011000010100000000000000000000000000000000000 0") |
This file contains hidden or 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) | |
pop_han_in_tw <- tribble( | |
~year, ~population, | |
1684, 120000, | |
1764, 666210, | |
1782, 912920, | |
1811, 1944737, |
This file contains hidden or 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
# reviewer pkg comes from https://ropenscilabs.github.io/reviewer/index.html | |
# remotes::install_github("ropenscilabs/reviewer") | |
browseURL(reviewer::diff_rmd("path/to/my-document.Rmd", | |
# this gets the sha of the previous commit | |
git2r::commits(n=2)[[2]]$sha)$raw) | |
# result will open in a web browser |