Thread: [R-gregmisc-users] SF.net SVN: r-gregmisc:[1568] trunk/gtools/R
Brought to you by:
warnes
From: <wa...@us...> - 2012-06-19 13:57:02
|
Revision: 1568 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1568&view=rev Author: warnes Date: 2012-06-19 13:56:52 +0000 (Tue, 19 Jun 2012) Log Message: ----------- Clean up R CMD check warnings. Modified Paths: -------------- trunk/gtools/R/addLast.R trunk/gtools/R/running.R Modified: trunk/gtools/R/addLast.R =================================================================== --- trunk/gtools/R/addLast.R 2012-06-18 20:32:10 UTC (rev 1567) +++ trunk/gtools/R/addLast.R 2012-06-19 13:56:52 UTC (rev 1568) @@ -1,16 +1,16 @@ addLast <- function( fun ) { if (!is.function(fun)) stop("fun must be a function") - if(!exists(".Last", env=.GlobalEnv)) - assign(".Last", fun, env=.GlobalEnv) + if(!exists(".Last", envir=.GlobalEnv)) + assign(".Last", fun, envir=.GlobalEnv) else { - Last <- get(".Last", env=.GlobalEnv) + Last <- get(".Last", envir=.GlobalEnv) newfun <- function(...) { fun() Last() } - assign(".Last", newfun, env=.GlobalEnv) + assign(".Last", newfun, envir=.GlobalEnv) } } Modified: trunk/gtools/R/running.R =================================================================== --- trunk/gtools/R/running.R 2012-06-18 20:32:10 UTC (rev 1567) +++ trunk/gtools/R/running.R 2012-06-19 13:56:52 UTC (rev 1568) @@ -58,21 +58,21 @@ if(is.null(Y)) # univariate { - funct <- function(which,what,fun,...) fun(what[which],...) + funct.uni <- function(which,what,fun,...) fun(what[which],...) if(simplify) - Xvar <- sapply(run.elements, funct, what=X, fun=fun, ...) + Xvar <- sapply(run.elements, funct.uni, what=X, fun=fun, ...) else - Xvar <- lapply(run.elements, funct, what=X, fun=fun, ...) + Xvar <- lapply(run.elements, funct.uni, what=X, fun=fun, ...) } else # bivariate { - funct <- function(which,XX,YY,fun,...) fun(XX[which],YY[which], ...) + funct.bi <- function(which,XX,YY,fun,...) fun(XX[which],YY[which], ...) if(simplify) - Xvar <- sapply(run.elements, funct, XX=X, YY=Y, fun=fun, ...) + Xvar <- sapply(run.elements, funct.bi, XX=X, YY=Y, fun=fun, ...) else - Xvar <- lapply(run.elements, funct, XX=X, YY=Y, fun=fun, ...) + Xvar <- lapply(run.elements, funct.bi, XX=X, YY=Y, fun=fun, ...) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2013-09-23 15:29:29
|
Revision: 1713 http://sourceforge.net/p/r-gregmisc/code/1713 Author: warnes Date: 2013-09-23 15:29:26 +0000 (Mon, 23 Sep 2013) Log Message: ----------- Mark 'addLast()' as defunct and move 'lastAdd()' function to a separate file. Modified Paths: -------------- trunk/gtools/R/addLast.R Added Paths: ----------- trunk/gtools/R/lastAdd.R Modified: trunk/gtools/R/addLast.R =================================================================== --- trunk/gtools/R/addLast.R 2013-09-23 15:23:34 UTC (rev 1712) +++ trunk/gtools/R/addLast.R 2013-09-23 15:29:26 UTC (rev 1713) @@ -1,39 +1,4 @@ addLast <- function( fun ) - { - .Deprecated(new=paste(".Last <- lastAdd(", deparse(substitute(fun)), ")", sep=''), - package='gtools' - ) - - if (!is.function(fun)) stop("fun must be a function") - if (!exists(".Last", envir = .GlobalEnv)) - assign(".Last", fun, envir = .GlobalEnv) - else - { - Last <- get(".Last", envir = .GlobalEnv) - newfun <- function(...) { - fun() - Last() - } - assign(".Last", newfun, envir = .GlobalEnv) - } - } - -lastAdd <- function( fun ) - { - if (!is.function(fun)) stop("fun must be a function") - if(!exists(".Last", envir=.GlobalEnv)) - { - return(fun) - } - else - { - Last <- get(".Last", envir=.GlobalEnv) - newfun <- function(...) - { - fun() - Last() - } - return(newfun) - } - } - + .Defunct(new=paste(".Last <- lastAdd(", deparse(substitute(fun)), ")", sep=''), + package='gtools' + ) Added: trunk/gtools/R/lastAdd.R =================================================================== --- trunk/gtools/R/lastAdd.R (rev 0) +++ trunk/gtools/R/lastAdd.R 2013-09-23 15:29:26 UTC (rev 1713) @@ -0,0 +1,22 @@ +## +## Replaces the (defunct) addLast() function. +## +lastAdd <- function( fun ) + { + if (!is.function(fun)) stop("fun must be a function") + if(!exists(".Last", envir=.GlobalEnv)) + { + return(fun) + } + else + { + Last <- get(".Last", envir=.GlobalEnv) + newfun <- function(...) + { + fun() + Last() + } + return(newfun) + } + } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-23 21:06:22
|
Revision: 1944 http://sourceforge.net/p/r-gregmisc/code/1944 Author: warnes Date: 2015-04-23 21:06:19 +0000 (Thu, 23 Apr 2015) Log Message: ----------- Remove debugging code and stray browser() call Modified Paths: -------------- trunk/gtools/R/smartbind.R trunk/gtools/R/strmacro.R Modified: trunk/gtools/R/smartbind.R =================================================================== --- trunk/gtools/R/smartbind.R 2015-04-23 20:21:21 UTC (rev 1943) +++ trunk/gtools/R/smartbind.R 2015-04-23 21:06:19 UTC (rev 1944) @@ -167,7 +167,6 @@ if(length(colClass)>1) # not just plain factor { - browser() warning( "column '", col, "' of class ", paste("'", colClass, "'", collapse=":", sep="'"), Modified: trunk/gtools/R/strmacro.R =================================================================== --- trunk/gtools/R/strmacro.R 2015-04-23 20:21:21 UTC (rev 1943) +++ trunk/gtools/R/strmacro.R 2015-04-23 21:06:19 UTC (rev 1944) @@ -22,11 +22,6 @@ { a[[i]] <- a[[i]] } - #if (nn[i] == "DOTS") - # { - # nn[i] <- "..." - # a[[i]] <- formals(function(...){})[[1]] - # } } names(a) <- nn a <- as.list(a) @@ -38,28 +33,12 @@ ## build replacement list reptab <- a # copy defaults first reptab$"..." <- NULL - #reptab$DOTS <- "" args <- match.call(expand.dots=TRUE)[-1] - #print(args) for(item in names(args)) - ##if(item %in% names(reptab)) reptab[[item]] <- args[[item]] - ##else - ## { - ## browser() - ## oldval <- reptab[["DOTS"]] - ## addval <- paste(item, "=", args[[item]]) - ## if(oldval>"") - ## newval <- paste(c(oldval, addval), collapse=", ") - ## else - ## newval <- addval - ## reptab[["DOTS"]] <- newval - ## } - #print(reptab) - ## do the replacements body <- strexpr for(i in 1:length(reptab)) @@ -77,8 +56,6 @@ body) } - #print(body) - fun <- parse(text=body) eval(fun, parent.frame()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |