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
# 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 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 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 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 |
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
# starting with code from | |
# https://gist.github.com/tomhopper/faa24797bb44addeba79?fbclid=IwAR3FFiHpUhTESqi_ylASZP5-zYD0lOrQyyHM2MSEvnVRCIykmjNREGTv4Uk | |
library(ggplot2) | |
library(grid) | |
library(dplyr) | |
#' Create some data to plot | |
n <- 100 | |
df <- data.frame(DateTime = seq(10, 20, length.out = 100), |
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) | |
library(gh) | |
.token = "" # get one from https://github.com/settings/tokens | |
# get all pkgs on GitHub mirror of CRAN | |
n <- 5000 # 16125 # https://github.com/cran | |
cran_repos <- gh("/users/:username/repos", | |
username = "cran", |
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
#------------------------------------------------------ | |
# Exploring the PCA published by Prentiss (1998) to understand the | |
# usefulness of the Sullivan and Rozen debitage typology | |
# read in & tidy the data ----------------------------------------------- | |
library(tidyverse) | |
# got these data from table 7 (p. 644) of https://www.jstor.org/stable/2694112 | |
# OCR'd using https://tabula.technology/ | |
prentiss <- readr::read_csv("tabula-Prentiss 1988.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
library("shiny") | |
library("EBImage") # >= 4.19.3 | |
library(imager) | |
ui <- fluidPage(# Application title | |
titlePanel("Image outline, chords, and landmarks"), | |
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
# https://arxiv.org/pdf/1809.09328.pdf & https://twitter.com/CT_Bergstrom/status/1035327464644333568 | |
# they use Mathematica, boo! So let's make them with R | |
# starting with https://stackoverflow.com/q/33396168/1036500 | |
library(ggplot2) | |
p <- ggplot() + | |
geom_point(data = anscombe, |
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
# Summarising multiple metric attributes of artefacts | |
p1 <- read_excel("data/riumailuoi.xlsx", sheet = 'phase1') | |
summary_stats_table <- function(x) { | |
x %>% | |
select(Mass, | |
Length, | |
Width, | |
Thickness, |