Skip to content

Instantly share code, notes, and snippets.

View SimonGoring's full-sized avatar

Simon SimonGoring

View GitHub Profile
@SimonGoring
SimonGoring / Dating_neotoma_Pollen
Last active August 29, 2015 14:18
Figure out the age control by year data for Neotoma.
library(neotoma)
library(reshape2)
pollen_data <- get_dataset(datasettype= 'pollen')
full_records <- get_download(pollen_data) # this takes a bit of time
pub.dates <- get_publication(pollen.data) # so does this
earliest.year <- do.call(rbind.data.frame,
lapply(pub.dates, function(x)data.frame(id = NA,
@SimonGoring
SimonGoring / Data upload to Neotoma
Created June 4, 2015 20:56
Rate of data upload to Neotoma: 2014 - present
library(neotoma)
library(ggplot2)
library(reshape2)
ds_upload <- get_dataset()
subyr <- lapply(ds_upload, function(x){
if(nrow(x$submission) == 0){
subdate <- NA
} else {
@SimonGoring
SimonGoring / neotoma_and_bacon
Last active August 14, 2017 18:14
A quick example to load a data file from Neotoma and then run Bacon.
# This needs to run in the directory in which you have Bacon installed.
# If you do not currently have the `neotoma` package installed then uncomment
# and run the following code. Right now you will need to install the package from GitHub
# because our latest bug fixes haven't been pushed up into CRAN.
#
# install.packages('devtools')
# library(devtools)
# install_github('ropensci/neotoma')
#
# The Neotoma package is described more fully here:
@SimonGoring
SimonGoring / Neotoma_CumulativePlot.R
Created June 15, 2015 21:39
Create Cumulative plot for Neotoma uploads. Missing secondary Y axis.
library(neotoma)
library(ggplot2)
library(lubridate)
library(reshape2)
all.ds <- get_dataset()
sub_tables <- function(x){
dates <- try(as.Date(x$submission[,1]))
@SimonGoring
SimonGoring / Cruddy problem
Created July 29, 2015 02:59
This is a chunk of my RMarkdown file that's having a problem.
```{r figure1, fig.width=6, fig.height=5, echo = FALSE, warning = FALSE, message=FALSE}
# This is the chunk where 'climate_values' is created (it's the one causing errors)
land_use$class[land_use$class == 'Water'] <- NA
land_use_plot <- natural[[2]] +
geom_tile(data = land_use, aes(x = x, y = y, fill = class)) +
scale_fill_manual(values = c('#ff7f00', '#e41a1c', '#33a02c'))
# This executes the map figure shown for GEOG378 Section 2.1 using R.
# The figure demonstrates the impact that changing datum may have on lat/long coordinates.
# Load the package 'rgdal'. If this package is missing on your system you can load it
# using the call 'install.packages('rgdal')'
library(rgdal)
# This is a built-in GDAL command, implemented in R using the rgdal package loaded above.
datum_list <- projInfo(type='datum')
@SimonGoring
SimonGoring / ClusterAnalysisStart.R
Created October 12, 2015 19:35
Basic layout for doing simple cluster analysis in R using the Neotoma Package, across the forest, prairie boundary.
library(neotoma)
ostracode <- get_dataset(datasettype='ostracode surface sample', loc=c(-100,43,-92,48))
chemistry <- get_dataset(datasettype='water chemistry', loc=c(-100,43,-92,48))
diatoms <- get_dataset(datasettype='diatom surface sample', loc=c(-100,43,-92,48))
pollen <- get_dataset(datasettype='pollen surface sample', loc=c(-100,43,-92,48))
ostracode_dl <- get_download(ostracode)
chemistry_dl <- get_download(chemistry)
diamtom_dl <- get_download(diatoms)
@SimonGoring
SimonGoring / scrape_ECOLOG.R
Created December 13, 2015 19:59
A short script to scrape ECOLOG messages.
# Scraping ECOLOG-L for job ads:
# This is the format of an ecolog URL:
# https://listserv.umd.edu/cgi-bin/wa?A1=ind1412e&L=ecolog-l
#
# most of it is pretty common. The key portion is A1=ind[YY][MM][a-e] where we
# insert the YY year and MM month, and then cycle a - e by week.
#
# This then returns an HTML page where the unique messages are
library(plyr)
@SimonGoring
SimonGoring / .block
Last active March 15, 2016 21:26
Force-Directed Diagram of Simon Goring's publication network based on DOIs and ORCiDs.
license: MIT
<resource xmlns:xmlns="http://datacite.org/schema/kernel-3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd">
<creators>
<Creator>
<creatorName>Labelle, Claude</creatorName>
<affiliation>1804 Tupper No. 2, Montreal, PQ H3H 1N4, CANADA</affiliation>
</Creator>
<Creator>
<creatorName>Larouche, Alayn C.</creatorName>
<affiliation>Laboratoire Jacques-Rousseau, Département de géographie, Université de Montréal, C.P. 6128 Succursale A, Montréal, PQ H3C 3J7, CANADA</affiliation>
</Creator>