knitr::opts_chunk$set(echo = TRUE)
suppressMessages(library(dplyr))
suppressMessages(library(knitr))
suppressMessages(library(kableExtra))

Plimits <- lapply(params$runPM, function(x) x@Caption) %>% unlist()
chk <- grepl("<", Plimits)
if (sum(chk)) {
  ind <- which(chk)  
  for (x in ind)
    Plimits[x] <- gsub("<", "\\\\<", Plimits[x])
}

if (length(Plimits)>1)
  cat("## Performance Objectives\n")
if (length(Plimits)==1)
  cat("## Performance Objective\n")

for (xx in 1:length(Plimits)) {
  # cat("#### ", xx, ": ", Plimits[xx], " \n\n", sep="")
  cat(xx, ": ", Plimits[xx], " \n\n", sep="")
}
if (use.colors) {
  quants <- seq(0, 1, length.out=length(cols)-1)
  levels <- cut(quants, quants) %>% levels()
} else {
  # cols <- rep("black", length(quants)+1)
  show.legend <- FALSE
}
htmlDF <- df # bind_rows(htmlDF1, htmlDF2)

TabDF <- tidyr::spread(htmlDF, PM, prob)
# if (format!='latex') TabDF <- cbind(data.frame("#"=1:nMPs), TabDF)

TabDF <- TabDF %>% dplyr::arrange(desc(min))

TabDF$min <- NULL
TabDF$prob <- NULL

MPwithurl <- !is.na(TabDF$url) 
TabDF$MP[MPwithurl] <- paste0("<a href='", TabDF$url[MPwithurl],"'>", TabDF$MP[MPwithurl],"</a>")
TabDF$url <- NULL
TabDF$Type <- as.factor(TabDF$Type)

cnames <- colnames(TabDF)
cind <- which(cnames == "Type")
cnames <- cnames[(cind+1):length(cnames)]



tabout <- DT::datatable(TabDF, escape=FALSE, filter='top', 
                        extensions = c('Buttons', 'Responsive'), 
                        class = 'cell-border stripe', 
                        options = list(
                          dom = 'Blfrtip',
                          buttons = 
                            list('copy', 'print'),
                          lengthMenu = list(c(10,20, 50, 100, -1), list('10', '20', '50','100', 'All')),
                          pageLength = 20, 
                          autoWidth = auto_width)) 
if (use.colors) tabout <- tabout %>% 
  DT::formatStyle(cnames, color = DT::styleInterval(cuts=quants, values=cols)) 

tabout


DLMtool/DLMtool documentation built on June 20, 2021, 5:20 p.m.