R/mixing.R

Defines functions mixing

Documented in mixing

mixing<-function(x,toplot="paramX",param=c(1,1),add=FALSE,...){
#### F. Guillaume Blanchet - Avril 2013
##########################################################################################
	type<-c("paramX","paramTr","paramRandom","means","sigma","RandomVar","RandomCommSp")
	toplot<-match.arg(toplot,type)
	
	if(!(toplot=="RandomVar" | toplot=="RandomCommSp")){
		if(toplot=="means" & !any(class(x)=="HMSCdataTrait")){
			if(length(param)!=1){
				stop("'param' should have a length of 1")
			}
			mix<-x$model[[toplot]][,param]
		}else{
			if(length(param)!=2){
				stop("'param' should have a length of 2")
			}
			mix<-x$model[[toplot]][param[1],param[2],]
		}
	}else{
		mix<-x$model[[toplot]]
	}
	
	if(add){
		lines(mix,...)
	}else{
		plot(mix,type="l",...)
	}
}

Try the HMSC package in your browser

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

HMSC documentation built on May 2, 2019, 6:53 p.m.