Thread: [R-gregmisc-users] SF.net SVN: r-gregmisc:[1901] trunk/gplots/R/bandplot.R
Brought to you by:
warnes
From: <wa...@us...> - 2014-12-02 00:07:57
|
Revision: 1901 http://sourceforge.net/p/r-gregmisc/code/1901 Author: warnes Date: 2014-12-02 00:07:48 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Simplify model.frame code for bandplot.formula. Modified Paths: -------------- trunk/gplots/R/bandplot.R Modified: trunk/gplots/R/bandplot.R =================================================================== --- trunk/gplots/R/bandplot.R 2014-12-01 22:55:41 UTC (rev 1900) +++ trunk/gplots/R/bandplot.R 2014-12-02 00:07:48 UTC (rev 1901) @@ -18,7 +18,7 @@ if(length(sd.col)<length(sd)) sd <-rep(sd.col,length=length(sd)) if(length(sd.lwd)<length(sd)) sd <-rep(sd.lwd,length=length(sd)) - if(length(sd.lty)<length(sd)) sd <-rep(sd.lty,length=length(sd)) + if(length(sd.lty)<length(sd)) sd <-rep(sd.lty,length=length(sd)) if(!add) { m <- match.call(expand.dots = TRUE) @@ -54,7 +54,7 @@ ) } - + } @@ -79,33 +79,35 @@ stop("x missing or incorrect") if (missing(na.action)) na.action <- getOption("na.action") - m <- match.call(expand.dots = FALSE) - if (is.matrix(eval(m$data, parent.frame()))) - m$data <- as.data.frame(data) - m$formula <- m$x - m$... <- m$x <- m$f <- m$iter <- m$delta <- NULL - m$xlab <- m$ylab <- m$add <- m$sd <- NULL - m$sd.col <- m$sd.lwd <- m$sd.lty <- NULL - m$method <- m$width <- m$n <- NULL - m[[1]] <- as.name("model.frame") - mf <- eval(m, parent.frame()) + mf <- match.call(expand.dots = FALSE) + + m <- match(c("x", "data", "subset", "na.action"), names(mf), 0L) + + # rename 'x' to 'formula' + names(mf)[m[2]] <- "formula" + + mf <- mf[c(1L, m)] + mf$drop.unused.levels <- TRUE + mf[[1L]] <- quote(stats::model.frame) + mf <- eval(mf, parent.frame()) + response <- attr(attr(mf, "terms"), "response") - + sx <- substitute(x) if (is.null(xlab)) { - if (mode(x) != "name") + if (mode(x) != "name") xlab <- deparse(sx[[3L]]) else - xlab <- "x" + xlab <- "x" } if (is.null(ylab)) { - if (mode(x) != "name") + if (mode(x) != "name") ylab <- deparse(sx[[2L]]) else - ylab <- "y" + ylab <- "y" } bandplot.default(x=mf[[-response]], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-12-02 01:09:05
|
Revision: 1902 http://sourceforge.net/p/r-gregmisc/code/1902 Author: warnes Date: 2014-12-02 01:09:01 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Code cleanup. Modified Paths: -------------- trunk/gplots/R/bandplot.R Modified: trunk/gplots/R/bandplot.R =================================================================== --- trunk/gplots/R/bandplot.R 2014-12-02 00:07:48 UTC (rev 1901) +++ trunk/gplots/R/bandplot.R 2014-12-02 01:09:01 UTC (rev 1902) @@ -59,7 +59,7 @@ bandplot.formula <- function(x, - data=parent.frame(), + data, subset, na.action, xlab=NULL, @@ -80,20 +80,24 @@ if (missing(na.action)) na.action <- getOption("na.action") + ## construct call to model.frame to generate model matrix mf <- match.call(expand.dots = FALSE) - m <- match(c("x", "data", "subset", "na.action"), names(mf), 0L) - - # rename 'x' to 'formula' - names(mf)[m[2]] <- "formula" - mf <- mf[c(1L, m)] mf$drop.unused.levels <- TRUE mf[[1L]] <- quote(stats::model.frame) + + ## rename 'x' to 'formula' + names(mf)[2] <- "formula" + mf <- eval(mf, parent.frame()) + ## now extract x and y response <- attr(attr(mf, "terms"), "response") + x <- mf[[-response]] + y <- mf[[response]] + ## get x and y axis labels sx <- substitute(x) if (is.null(xlab)) { @@ -110,8 +114,9 @@ ylab <- "y" } - bandplot.default(x=mf[[-response]], - y=mf[[response]], + ## now call the default method to actually do the work + bandplot.default(x, + y, ..., xlab=xlab, ylab=ylab, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-12-02 01:46:38
|
Revision: 1906 http://sourceforge.net/p/r-gregmisc/code/1906 Author: warnes Date: 2014-12-02 01:46:35 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Move '...' argument to bandplot.formula to match man page. Modified Paths: -------------- trunk/gplots/R/bandplot.R Modified: trunk/gplots/R/bandplot.R =================================================================== --- trunk/gplots/R/bandplot.R 2014-12-02 01:39:19 UTC (rev 1905) +++ trunk/gplots/R/bandplot.R 2014-12-02 01:46:35 UTC (rev 1906) @@ -62,9 +62,9 @@ data, subset, na.action, + ..., xlab=NULL, ylab=NULL, - ..., add=FALSE, sd=c(-2:2), sd.col=c("magenta","blue","red", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |