R/getOffset.R

Defines functions getOffset

Documented in getOffset

getOffset <- function(y)
#	Extract offset vector or matrix from data object and optional arguments.
#	By default, offset is constructed from the lib.size and norm.factors
#	but offset supplied explicitly takes precedence

#	Gordon Smyth
#	26 Jan 2011. Last modified 11 Jan 2012.
{
	offset <- y$offset
	lib.size <- y$samples$lib.size
	norm.factors <- y$samples$norm.factors
	
	if(!is.null(offset)) {
		return(offset)
	} else {		
		if(!is.null(norm.factors)) lib.size <- lib.size*norm.factors
		return(log(lib.size))
	}
}

Try the edgeR package in your browser

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

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.