Skip to content

Instantly share code, notes, and snippets.

@SimonGoring
Created October 12, 2015 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SimonGoring/9ef7eafc919bcbba4e0a to your computer and use it in GitHub Desktop.
Save SimonGoring/9ef7eafc919bcbba4e0a to your computer and use it in GitHub Desktop.
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)
pollen_dl <- get_download(pollen)
# This works because these methods were designed for pollen data largely.
# Compiles the pollen data to
pollen_dc <- compile_downloads(compile_taxa(pollen_dl, 'P25'))
pollen_dc_ppt <- pollen_dc[,11:34] / rowSums(pollen_dc[,11:34], na.rm=TRUE)
plot(hclust(dist(pollen_dc_ppt)), cex=0.5)
# These don't because we have variable column lengths & other issues in the data that need to be addressed in the 'counts' method.
chem_counts <- do.call(rbind.data.frame,counts(chemistry_dl))
ostracode_counts <- do.call(rbind.data.frame,counts(ostracode_dl))
diatom_counts <- do.call(rbind.data.frame,counts(diatom_dl))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment