R/poly.areas.union.R

Defines functions poly.areas.union

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)
}	
	
	
	
ices-tools-dev/NephAssess documentation built on Oct. 19, 2024, 6:33 p.m.