poly.areas.union<- function(files, years)
{
if( length(files) != length(years) )
{
stop("Mismatch between number of files and years")
}
if( length(files) == 1)
{
stop("At least 2 files needed for intersection")
}
pol<- vector("list", length(files))
for(i in 1:length(files) )
{
load(files[i])
pol[[i]]<- res.list$Polygon
}
for(i in 1:(length(pol)-1) )
{
if(i == 1)
{
int<- union(pol[[i]], pol[[i+1]])
}
if(i > 1)
{
int<- union(int, pol[[i+1]])
}
}
return(int)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.