## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----eval=FALSE---------------------------------------------------------------
# myScore <- function(cluster, cov, covinv,
#                     exp, linked, linked.cov,
#                     linked.exp, k) {
#   ## Calculations
#   n <- nrow(cluster)
#   scores <- # function to calculate scores
#     bins <- # function to bin scores
# 
#     ## Return
#     ret <- list()
#   ret$score <- scores
#   ret$scoreName <- "scores"
#   ret$bins <- bins
#   ret$binName <- "bins"
#   ret$interest <- rep("", n)
#   ret$is.interest <- which(ret$interest != "")
#   ret
# }
# 
# pandemonium(df, getScore = myScore)

## ----echo=TRUE,eval=FALSE-----------------------------------------------------
# outsideScore <- function(scores, scoreName = NULL) {
#   function(cluster, ...) {
#     ret <- list()
#     n <- nrow(cluster)
#     ret$score <- scores
#     ret$bins <- cut(scores, stats::quantile(scores, c(0, 0.25, 0.75, 1)) - c(1, 0, 0, 0), labels = c("lower", "inner", "upper"))
#     ret$interest <- rep("", n)
#     ret$is.interest <- which(ret$interest != "")
#     ret$scoreName <- as.character(scoreName)
#     ret$binName <- "quartile"
#     ret
#   }
# }
# 
# pandemonium(
#   df = Bikes$space1, linked = Bikes$space2,
#   getScore = outsideScore(Bikes$other$res, "Residual")
# )

