R/meltingCurveSlope.R

Defines functions meltingCurveSlope

meltingCurveSlope <- function(model, xInfl){
  ## Compute melting point slope of sigmoidal model.
  if (class(model)!="try-error" & !is.na(xInfl)){
    ## Define expressions for first derivative of sigmoid function:
    strDeriv1  <- fctSigmoidTR(deriv=1)
    exprDeriv1 <- parse(text=strDeriv1)
    
    ## Extract model parameters:
    coeffs <- coefficients(model)
    
    ## Determine slope at inflection point:
    slope <- eval(exprDeriv1, envir=list(a=coeffs[["a"]], b=coeffs[["b"]], 
                                         Pl=coeffs[["Pl"]], x=xInfl))
  } else{slope <- NA}
  return(slope)
}
DoroChilds/TPP documentation built on Oct. 31, 2021, 4:38 a.m.