cpdist integrated into model
This commit is contained in:
14
Parses.R
14
Parses.R
@@ -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')))
|
||||
|
||||
Reference in New Issue
Block a user