# Search for the sites around Marion Lake, BC. I want to find sites within about 1km.
marion <- get_site(sitename = "Marion Lake*")
marion_close <- get_closest(marion, n = 10, buffer = 1)
# Returns 116 records (as of 13/07/2015). These are the pollen records though, we want the sites:
geochron.records <- get_geochron(marion_close)
# We want to extract all the radiocarbon ages from the records:
get_ages <- function(x){
any.ages <- try(x[[2]]$age[x[[2]]$age.type == 'Radiocarbon years BP'])
if(class(any.ages) == 'try-error') output <- NA
if(!class(any.ages) == 'try-error') output <- unlist(any.ages)
output
}
radio.chron <- unlist(sapply(geochron.records, get_ages))
hist(radio.chron[radio.chron<40000], breaks=seq(0, 25000, by = 1000),
main = 'Radiocarbon dates for Pseudotsuga records',
xlab = 'Radiocarbon date (14C years before 1950)')
Run the code above in your browser using DataLab