Skip to content

Instantly share code, notes, and snippets.

View taddallas's full-sized avatar

Tad Dallas taddallas

View GitHub Profile
@taddallas
taddallas / relAbund.R
Last active November 28, 2019 01:01
Relative abundance does what now!?
# my "true community" (a census)
comm <- sample(as.factor(letters[1:5]), 1000,
prob=c(0.6,0.4,0.2,0.1,0.1), replace=TRUE)
# taking random samples from my community and calculating relative abundance
samps <- plyr::ldply(1:1000, function(x){
set.seed(x)
tmp <- table(sample(comm, 10))
tmp <- tmp/sum(tmp)
return(tmp)
@taddallas
taddallas / WOS scrape
Last active April 27, 2022 13:02
R script to scrape citation counts from the Web of Science. Used for a project involving host-parasite interactions, but may be useful to someone out there. It's finicky, and I take no responsibility for it. Best of luck.
# RSelenium method to scrape citation counts from WOS
**Updates**: RSelenium package has switched some of the code around, causing breaking changes to this old gist. Web of Science has also changed their layout, causing breaking changes. The current code is a hacky patch to allow for some WoS interactivity and data acquistion.
### Currently set up to work with the RSelenium docker image
library(RSelenium)
library(plyr); library(dplyr)
library(RSelenium)