R/N2O_tier2.R

N2O_tier2 <- function(v, p){

	if (is.vector(v)) {
		v <- t(as.matrix(v))
	}
	
	stopifnot(all(colnames(v) %in% names(p)))
	varnames <- colnames(p)
	pp <- v[varnames]  
	apply(p, 1, function(x, ...)sum(x*pp), na.rm=TRUE)
}

Try the emissions package in your browser

Any scripts or data that you put into this service are public.

emissions documentation built on May 2, 2019, 6:09 p.m.