1 | minmax.mat(str, varnms)
|
str |
|
varnms |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (str, varnms)
{
comps <- strsplit(str, ",")
MMM <- matrix(data = rep(c(-Inf, Inf), length(varnms)), nrow = length(varnms),
ncol = 2, byrow = TRUE)
rownames(MMM) <- varnms
for (i in 1:(length(comps[[1]]) - 1)) {
nodestr <- strsplit(trim(comps[[1]][i]), " ")
node.varnm <- trim(nodestr[[1]][1])
node.dir <- trim(nodestr[[1]][2])
node.split <- trim(nodestr[[1]][3])
var.row <- which(varnms == node.varnm)
if (node.dir == "<=") {
MMM[var.row, 2] <- as.numeric(node.split)
}
else {
MMM[var.row, 1] <- as.numeric(node.split)
}
}
y <- comps[[1]][length(comps[[1]])]
return(list(M = MMM, y = y))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.