R/plotBehavior.R

Defines functions plotBehavior

Documented in plotBehavior

#' A method for plotting crmetric objects
#' 
#' Takes a df generated by RQ1 and plots the behavior of its metrics 
#' for the specified subsamples. 
#' 
#' @author Richard D. Yentes \email{rdyentes@ncsu.edu}
#' @param x a df generated by runnign rq1
#' @param min the minmum of the interval over which to evaluate the behavior 
#' @param max the maximum of the interval over which to evaluate the behavior
#' @export

plotBehavior <- function(x, method, ...) {
  lsRQ1 <- function(df, ...) {
    args <- list(...)
    ls <- dispatchRQ1(df, what='longstring', from=args$min, to=args$max, by=.1, i=i)
    plot(ls$informedness, i)
  }
  
  mdRQ1 <- function(df, method, ...) {
    args <- list(...)
    hexkey <- read.csv('~/notebooks/dissertation/sourcedata/hexkey.csv', header=FALSE)[1:100]
    hexkey <- which(hexkey==-1)
    rcdf <- rdydisstools::reverseCode(df, hexkey, max=7)
    md <- dispatchRQ1(rcdf, what="mahad", from=args$min, to=args$max, by= .1, i=i)
    plot(md$informedness, i)
    
  }
  
  eoRQ1 <- function(df, method, ...) {
    args <- list(...)
    hexkey <- read.csv('~/notebooks/dissertation/sourcedata/hexkey.csv', header=FALSE)[1:100]
    hexkey <- which(hexkey==-1)
    rcdf <- rdydisstools::reverseCode(df, hexkey, max=7)
    eo <- dispatchRQ1(rcdf, what="evenodd", factors=args$factors, from=args$min, to=args$max, by= .1, i=i)
    plot(eo$informedness, i)
    
  }
  
  switch(method, 
         "lsRQ1" = lsRQ1(x, ...),
         "mdRQ1" = mdRQ1(x, ...),
         "eoRQ1" = eoRQ1(x, ...)
  )
}
ryentes/rdy-dissertation-tools documentation built on Dec. 5, 2019, 10:23 p.m.