R/QQplotImproved.R

Defines functions QQplotImproved

Documented in QQplotImproved

#' Make an improved "empirical" QQ plot
#' 
#' This function creates an improved "empirical" QQ plot: it adds an abline of slope 1 and sets the range of two vectors as limts of x and y axes.
#' 
#' @param x A numeric vector
#' @param y A numeric vector
#' @param xlab A character label of x axis
#' @param ylab A character label of y axis
#' @param main A character label of QQ plot title
#' @author Alexander Kheirallah ([email protected]) 
#' @export

QQplotImproved <- function(x,y,xlab="Xlab",ylab="Ylab",main="Title") {
  if(class(x)!="numeric"|class(y)!="numeric") stop("The input data is not numeric. Please coerce it to numeric type.")
  xlim <- range(0,x)
  ylim <- range(0,y)
  qqplot(x,y,
         xlim = xlim,
         ylim = ylim,
         xlab = xlab,
         ylab = ylab,
         main = main)
  abline(a=0, b=1, lty="dotted")
}
msxakk89/dat documentation built on March 25, 2020, 3:18 p.m.