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(foreach) | |
library(doSNOW) | |
library(dplyr) | |
library(httr) | |
google_books_count = function (search_terms) { | |
require(httr) | |
terms = str_c(search_terms, collapse = '+') | |
query_url = str_c('https://www.googleapis.com/books/v1/volumes', | |
'?', |
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(rentrez) | |
library(magrittr) | |
library(xml2) | |
xml_raw = entrez_fetch(db="pubmed", | |
id=27019001, | |
rettype = 'xml') | |
xml_parsed = read_xml(xml_raw) | |
grant_id = xml_find_all(xml_parsed, '//Grant') %>% |
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
given | family | title | pub_year | |
---|---|---|---|---|
A | Avramides | The Subject's Point of View * By KATALIN FARKAS | 2009 | |
A | Woodfield | Doing Without Concepts By Edouard Machery * By EDOUARD MACHERY | 2009 | |
A C | Paseau | How to type: reply to Halbach | 2009 | |
A C | Paseau | Why the subtraction argument does not add up | 2002 | |
A C | Paseau | An exact measure of paradox | 2012 | |
A C | Paseau | Did Frege commit a cardinal sin? | 2015 | |
A C | Paseau | The overgeneration argument(s): A succinct refutation | 2013 | |
A W | Heathcote | Gettier and the stopped clock | 2012 | |
A W | Moore | Not to be Taken at Face Value | 2009 |
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(rstan) | |
## options(mc.cores = parallel::detectCores()) | |
## Data should be here: <https://drive.google.com/open?id=1BUV8mChrZ0UkyW2G4EHB5wc1taUpMZUM> | |
load('mwe.Rdata') | |
## dataf: The data; response is `w_use` | |
## W_3nn: row-normalized spatial weights matrix, based on 3 nearest neighbors, in triplet sparse form | |
## W_dnn: row-normalized spatial weights matrix, distance-based, in triplet sparse form | |
parsed = stanc(file = 'sdm.stan', verbose = TRUE) |
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
#!/bin/bash | |
## This script synchronizes AlpineQuest tracks using rsync, then converts them to gpx | |
RED='\033[0;31m' | |
NC='\033[0m' | |
echo -e "${RED}Make sure SSHDroid is running before using this script${NC}" | |
startfolder="$PWD" | |
## SSHDroid: <https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en_US> | |
apqfolder="/Users/danhicks/Google Drive/hiking/GPS tracks/AlpineQuest conversion/AlpineQuest sync" |
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
## Cleveland Dot Plots or Dumbell Plots | |
## This gist notes some approaches for drawing Cleveland dot plots or dumbell plots in `ggplot` | |
library(tidyverse) | |
n = 10 | |
dataf = tibble(x = rep(1:n, 2), | |
category = c(rep('A', n), rep('B', n)), | |
value = x + 2*(category == 'B')) |
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
## It took me three days to find this solution! | |
## <https://stackoverflow.com/questions/44688623/adding-custom-images-to-ggplot-facets/44897816#44897816> | |
annotation_custom2 <- function (grob, xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf, data) | |
{ | |
layer(data = data, stat = StatIdentity, position = PositionIdentity, | |
geom = ggplot2:::GeomCustomAnn, | |
inherit.aes = FALSE, params = list(grob = grob, | |
xmin = xmin, xmax = xmax, | |
ymin = ymin, ymax = ymax)) |
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
#!/bin/bash | |
## Just a little Bash wrapper for a Ghostscript call | |
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile="$2" "$1" |
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
## If one group is much larger than the other, does this | |
## inflate type I error rates or bias estimates? | |
library(tidyverse) | |
library(broom) | |
library(tictoc) | |
set.seed(2020-03-16) | |
## Parameters ---- | |
a_n = 300 |
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
## Parses a roster page saved from Canvas and allocates students to groups within discussion sections | |
## To use: | |
## 1. Navigate to the People page in a Canvas course using your browser | |
## 2. Right-click on the page and select "Save as" | |
## 3a. `Rscript parse.R path/to/roster.html` | |
## -OR- | |
## 3b. Save it to `data_folder` as `roster.html`. `Rscript parse.R` or run in RStudio. | |
## Setup ---- |
OlderNewer