cpdist integrated into model

This commit is contained in:
2019-02-04 10:50:05 +00:00
parent 54f5e8c418
commit fc86790b9d
3 changed files with 260 additions and 120 deletions

View File

@@ -30,6 +30,20 @@ delNA <- function(vec) {
return(vec[!is.na(vec)])
}
buildExpr <- function(pressStatus) {
#pressStatus is a two column DF of name of pressure and status Ii.e. on or off)
MEANPRESS = 0
expr <- "("
for (p in 1:nrow(pressStatus)) {
if (pressStatus$status[p] == 'On') symbol='>=' else symbol='<='
expr <- paste0(expr, "(\"", pressStatus$code[p], "\"", symbol, MEANPRESS, ") & ")
}
expr<-substr(expr, 1, nchar(expr)-2)
expr<-paste0(expr, ')')
return(expr)
}
parseScenario <- function(press, prefix = 'p') {
pressNames <- colnames(press)[2:length(colnames(press))]
coefs <- matrix(data=NA, nrow=length(pressNames), ncol=2, dimnames=list(NULL, c('growth', 'confidence')))