diff --git a/DESCRIPTION b/DESCRIPTION index 5d6a10a..10f0310 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: tukeyedar -Version: 0.1.1.9000 +Version: 0.2.0 Type: Package Title: Tukey Inspired Exploratory Data Analysis Functions Authors@R: person(given = "Manuel", diff --git a/NEWS.md b/NEWS.md index 335eb8f..5731cc2 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# tukeyedar (development version) +# tukeyedar 0.2.0 * Added a Normal QQ plot option to `eda_qq` * Added symmetrical Normal fit plot function `eda_normfit` * Updated eda_boxls aesthetics diff --git a/R/eda_3pt.R b/R/eda_3pt.R index 66e8f9f..d5bd8bb 100755 --- a/R/eda_3pt.R +++ b/R/eda_3pt.R @@ -134,12 +134,13 @@ eda_3pt <- function(dat, x, y, px = 1, py = 1, tukey = TRUE, axes = TRUE, pdf(NULL) plot(x = x, y = y, type = "n", xlab = "", ylab = "", xaxt = "n", yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) + # y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 # Set plot parameters diff --git a/R/eda_bipow.R b/R/eda_bipow.R index ad5cb24..b77e909 100755 --- a/R/eda_bipow.R +++ b/R/eda_bipow.R @@ -30,9 +30,16 @@ #' #' @examples #' -#' eda_bipow(dat = cars, x = speed, y = dist) +#' data(cars) +#' # Example 1 +#' eda_bipow(dat = cars, x = speed, y = dist) +#' # Custom powers +#' eda_bipow(dat = cars, x = speed, y = dist, p = c(-1, -0.5, 0, 0.5, 1)) +#' # Adopt box-cox transformation +#' eda_bipow(dat = cars, x = speed, y = dist, tukey = FALSE, p = c(-1, -0.5, 0, 0.5, 1)) +#' -eda_bipow <- function(dat, x, y, p = c(3, 2, 1, .5, 0), tukey=TRUE, ...) { +eda_bipow <- function(dat, x, y, p = c(-1, 0, 0.5, 1, 2), tukey=TRUE, ...) { if(!missing(dat)) { @@ -48,10 +55,11 @@ eda_bipow <- function(dat, x, y, p = c(3, 2, 1, .5, 0), tukey=TRUE, ...) { # Plot data for each transformation M <- matrix( 1: ((nRows + 2)*(nCols + 2)),nrow=nRows + 2, ncol = nCols + 2, byrow=TRUE) - .pardef <- par(no.readonly = T) - on.exit(par(.pardef), add = TRUE) + .pardef <- par(mar = c(0,0,0,0)) +# on.exit(par(.pardef), add = TRUE) + on.exit(par(.pardef)) - par(mar = c(0,0,0,0)) + # par(mar = c(0,0,0,0)) lHeight <- c(0.3, rep(1, nCols),0.3 ) lWidth <- c(0.3, rep(1, nCols),0.3 ) layout(mat=M, widths = lWidth , heights= lHeight) diff --git a/R/eda_boxls.R b/R/eda_boxls.R index 85317be..9fc7d96 100755 --- a/R/eda_boxls.R +++ b/R/eda_boxls.R @@ -173,14 +173,17 @@ eda_boxls <- function(dat, x, fac, p = 1, tukey = FALSE, outlier=TRUE, fac.min <- which.min(nchar(fac.names)) fac.max <- which.max(nchar(fac.names)) y.labs <- c(fac.names[fac.min], fac.names[fac.max]) + y.wid <- max(strwidth( y.labs[1], units="inches"), + strwidth( y.labs[2], units="inches")) * in2line + 1.2 } else { - y.labs <- range(axTicks(2)) + # y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 } dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1.2 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1.2 # .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3.2,1)) diff --git a/R/eda_dens.R b/R/eda_dens.R index dc7d370..27f03fd 100755 --- a/R/eda_dens.R +++ b/R/eda_dens.R @@ -128,12 +128,13 @@ eda_dens <- function(x, y, fac = NULL, p = 1L, tukey = FALSE, fx = NULL, pdf(NULL) plot(x = dx, y = NULL, type = "n", xlab = "", ylab = "", xaxt = "n", yaxt='n', main = NULL, xlim = xlim, ylim = ylim) - y.labs <- range(axTicks(2)) + # y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 # Plot data .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3,1)) diff --git a/R/eda_lm.R b/R/eda_lm.R index c60c576..e162063 100755 --- a/R/eda_lm.R +++ b/R/eda_lm.R @@ -168,12 +168,13 @@ eda_lm <- function(dat, x, y, xlab = NULL, ylab = NULL, px = 1, py = 1, pdf(NULL) plot(x = x, y = y, type = "n", xlab = "", ylab = "", xaxt = "n", yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) + #y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3,1)) on.exit(par(.pardef)) diff --git a/R/eda_normfit.R b/R/eda_normfit.R index b4bba8a..4f8616b 100644 --- a/R/eda_normfit.R +++ b/R/eda_normfit.R @@ -181,12 +181,13 @@ eda_normfit <- function(dat, x=NULL, grp=NULL, p = 1, tukey = FALSE, plot(x = NULL, y = NULL, type = "n", xlab = "", ylab = "", xaxt = "n", xlim=c(1 - 0.4, length(grp_unique) + 0.4), ylim = dx_rng, yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) +# y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 # Set plot parameters .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3.2,1)) diff --git a/R/eda_qq.R b/R/eda_qq.R index 7793478..63d09ef 100755 --- a/R/eda_qq.R +++ b/R/eda_qq.R @@ -260,12 +260,13 @@ eda_qq <- function(x, y=NULL, fac = NULL, norm = FALSE, p = 1L, tukey = FALSE, pdf(NULL) plot(x = x, y = y, type = "n", xlab = "", ylab = "", xaxt = "n", yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) +# y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 # Set plot parameters .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3,1)) diff --git a/R/eda_sl.R b/R/eda_sl.R index 87225bb..6036a46 100755 --- a/R/eda_sl.R +++ b/R/eda_sl.R @@ -110,12 +110,13 @@ eda_sl <- function(dat, x, fac, p = 1, tukey = FALSE, sprd = "frth", pdf(NULL) plot(x = level, y = spread, type = "n", xlab = "", ylab = "", xaxt = "n", yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) + # y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3,1)) on.exit(par(.pardef)) diff --git a/R/plot.eda_polish.R b/R/plot.eda_polish.R index 2fdf1cc..41a62b5 100755 --- a/R/plot.eda_polish.R +++ b/R/plot.eda_polish.R @@ -96,13 +96,14 @@ plot.eda_polish <- function(x, type = "residuals", add.cv = FALSE, k = NULL, # Create a dummy plot to extract y-axis labels pdf(NULL) plot(x = cv, y = residuals, type = "n", xlab = "", ylab = "", xaxt = "n", - yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) + yaxt='n', main = NULL) + # y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 # Set plot parameters .pardef <- par(pty = "s", col = plotcol, mar = c(3,y.wid,3,1)) diff --git a/R/plot.eda_rline.R b/R/plot.eda_rline.R index 32adfa6..b27fea7 100755 --- a/R/plot.eda_rline.R +++ b/R/plot.eda_rline.R @@ -74,12 +74,13 @@ plot.eda_rline <- function(x, type = "model", xlab = NULL, ylab = NULL, grey = 0 pdf(NULL) plot(x = x$x, y = x$y, type = "n", xlab = "", ylab = "", xaxt = "n", yaxt='n', main = NULL) - y.labs <- range(axTicks(2)) + # y.labs <- range(axTicks(2)) + y.wid <- max( strwidth( axTicks(2), units="inches")) * in2line + 1.2 dev.off() # Compute the margin width (returned in inches before converting to lines) - y.wid <- max( strwidth( y.labs[1], units="inches"), - strwidth( y.labs[2], units="inches")) * in2line + 1 + # y.wid <- max( strwidth( y.labs[1], units="inches"), + # strwidth( y.labs[2], units="inches")) * in2line + 1 # Set plot parameters if(equal == TRUE ){ diff --git a/docs/404.html b/docs/404.html index 9d2fdac..17eeb29 100755 --- a/docs/404.html +++ b/docs/404.html @@ -24,7 +24,7 @@ tukeyedar - 0.1.1.9000 + 0.2.0