## getSites.R: return a list of sites for a given year (and set of projects, if specified)
##
getSites = function(proj = NULL, year = lubridate::year(Sys.time())) {
if (is.null(proj))
proj = getProjects(year)
rv = NULL
for (p in proj) {
top = projPath(p, year)
maybe = dir(top, pattern="^[-A-Z_a-z0-9']+", full.names=TRUE)
sitecodefiles = file.path(maybe, "SITECODE.TXT")
goodsites = basename(maybe)[file.exists(sitecodefiles)]
if (length(proj) > 1)
rv = c(rv, file.path(p, goodsites))
else
rv = goodsites
}
return(rv)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.