R/dist.plot.pscore.R

Defines functions dist.plot.pscore

dist.plot.pscore <- function(object,
                             sel           = NULL,
                             treat         = NULL,
                             stratum.index = NULL,
                             match.index   = NULL,
                             plot.type     = 1,
                             compare       = FALSE,
                             ...)
{ 
  data <- object$data

  ## ########
  ## find sel
  if(is.null(sel)){
    sel <- data
  }else{
    sel <- find.sel(data = data,
                    sel  = sel)
  }
  
  ## ##########
  ## find treat
  if (!is.character(treat) & !is.numeric(treat) & !is.null(treat)){
    stop("Argument 'treat' must be either numeric or a string.")
  }else{
    if (is.null(treat)){   
      name.treat <- object$name.treat
      treat      <- object$treat
    }else{
      A <- find.treat(data  = data,
                      treat = treat)
      treat      <- A[[1]]
      name.treat <- A[[2]]
    }
  }

  
  ## ###################
  ## check stratum.index  
  stratum.index <- rep(1, times=dim(data)[1])
  name.stratum.index <- ""

  
  ## #################
  ## check match.index  
  match.index <- rep(1, times=dim(data)[1])
  name.stratum.index <- ""


  
  ## ###############################################
  ## check plot.type & calculate value to be plotted
  if (!is.numeric(plot.type)){    
    stop("Argument 'plot.type' must be numeric.")
  }else{
    if (plot.type == 1){
      dist.plot.bars(sel        = sel,
                     treat      = treat,
                     name.treat = name.treat,
                     index      = stratum.index,
                     name.index = name.stratum.index,
                     compare    = FALSE,
                     match.T    = FALSE,
                     ...)
    }else{
      if(plot.type == 2)
        dist.plot.hist(sel        = sel,
                       treat      = treat,
                       name.treat = name.treat,
                       index      = stratum.index,
                       name.index = name.stratum.index,
                       compare    = FALSE,
                       match.T    = FALSE,
                       ...)
      else
        stop("Argument 'plottype' must be either 1 or 2.")
    }
  }
}


#dist.plot.pscore <- function(object,
#                             sel           = NULL,
#                             treat         = NULL,
#                             stratum.index = NULL,
#                             match.index   = NULL,
#                             plot.type     = 1,
#                             cat.levels    = 10,
#                             plot.levels   = 5,
#                             compare       = FALSE,
#                             label.match   = NULL,
#                             label.stratum = "Stratum",
#                             with.legend  = TRUE,                
#                             legend.title = NULL,
#                             legend.cex   = 0.9,              
#                             myoma        = c(2,2,2,2),
#                             mymar        = c(2,4,1,2),
#                             width        = 1,
#                             xlim         = NULL,
#                             ylim         = NULL,
#                             col          = NULL,
#                             las          = 1,
#                             font.main    = 2,
#                             font         = 1,
#                             main         = NULL,
#                             main.cex     = 1.2,
#                             sub.cex      = 0.9,
#                             bar.cex      = 0.8,
#                             ...)

Try the nonrandom package in your browser

Any scripts or data that you put into this service are public.

nonrandom documentation built on May 29, 2017, 11:41 p.m.