#' Preparing reaction norm models
#' build Jarquin et al (2014) covariate matrix (M)
jarquin_RN = function(covariable.id, df, env.id, stage.id=NULL, digits=8){
.DF = melt(df[,c(covariable.id,env.id,stage.id)],
id.vars = c(e.ids,stage.id),
variable.name = "covariable")
if(isTRUE(is.null(stage.id))){
.DF$variable = .DF$covariable
}else{.DF$variable = paste(.DF$covariable,.DF[,stage.id],sep="-")}
.DF=acast(ddply(.DF,.(env,variable),summarise,y=mean(value)),env~variable,value.var="y")
return(list(x.origin = round(.DF,digits),
x.scaled = round(scale(.DF, center=T,scale = T),digits)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.