[Sciviews-commits] r482 - komodo/SciViews-K/skin/icons/misc pkg/svKomodo pkg/svKomodo/R pkg/svKomodo/inst pkg/svKomodo/man pkg/svMisc pkg/svMisc/R pkg/svMisc/man pkg/svTools

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 2 15:45:56 CEST 2012


Author: phgrosjean
Date: 2012-07-02 15:45:55 +0200 (Mon, 02 Jul 2012)
New Revision: 482

Added:
   pkg/svMisc/R/batch.R
   pkg/svMisc/R/isJGR.R
   pkg/svMisc/man/batch.Rd
   pkg/svMisc/man/isJGR.Rd
Modified:
   komodo/SciViews-K/skin/icons/misc/.DS_Store
   pkg/svKomodo/DESCRIPTION
   pkg/svKomodo/NEWS
   pkg/svKomodo/R/svKomodo-internal.R
   pkg/svKomodo/inst/NEWS.Rd
   pkg/svKomodo/man/svKomodo-package.Rd
   pkg/svMisc/DESCRIPTION
   pkg/svMisc/NAMESPACE
   pkg/svMisc/NEWS
   pkg/svMisc/man/isAqua.Rd
   pkg/svMisc/man/isMac.Rd
   pkg/svMisc/man/isRgui.Rd
   pkg/svMisc/man/isWin.Rd
   pkg/svMisc/man/progress.Rd
   pkg/svTools/NAMESPACE
Log:
Functions isJGR() and batch() added in svMisc

Modified: komodo/SciViews-K/skin/icons/misc/.DS_Store
===================================================================
(Binary files differ)

Modified: pkg/svKomodo/DESCRIPTION
===================================================================
--- pkg/svKomodo/DESCRIPTION	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svKomodo/DESCRIPTION	2012-07-02 13:45:55 UTC (rev 482)
@@ -1,7 +1,7 @@
 Package: svKomodo
 Type: Package
-Version: 0.9-57
-Date: 2012-04-22
+Version: 0.9-58
+Date: 2012-06-22
 Title: SciViews GUI API - Functions to interface with Komodo Edit/IDE
 Authors at R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
   email = "phgrosjean at sciviews.org"))

Modified: pkg/svKomodo/NEWS
===================================================================
--- pkg/svKomodo/NEWS	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svKomodo/NEWS	2012-07-02 13:45:55 UTC (rev 482)
@@ -1,5 +1,10 @@
 = svKomodo News
 
+== Changes in svKomodo 0.9-58
+
+* The package was not loading correctly when not on .libPaths. Fixed.
+
+
 == Changes in svKomodo 0.9-57
 
 * svKomodo creates now at loading a .Last.sys() function in TempEnv indicating

Modified: pkg/svKomodo/R/svKomodo-internal.R
===================================================================
--- pkg/svKomodo/R/svKomodo-internal.R	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svKomodo/R/svKomodo-internal.R	2012-07-02 13:45:55 UTC (rev 482)
@@ -136,10 +136,10 @@
 	type <- getOption("ko.type")
 	req <- require
 	if (type == "http") {
-		req("svHttp", character.only = TRUE)
+		req("svHttp", character.only = TRUE, lib.loc = lib)
 		if (interactive()) try(startHttpServer())
 	} else {
-		req("svSocket", character.only = TRUE)
+		req("svSocket", character.only = TRUE, lib.loc = lib)
 		if (interactive()) try(startSocketServer())
 	}
 		

Modified: pkg/svKomodo/inst/NEWS.Rd
===================================================================
--- pkg/svKomodo/inst/NEWS.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svKomodo/inst/NEWS.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -1,6 +1,12 @@
 \name{NEWS}
 \title{NEWS file for the svKomodo package}
 
+\section{Changes in version 0.9-58}{
+	\itemize{
+    \item{ The package was not loading correctly when not on \code{.libPaths}. Fixed. }
+  }
+}
+
 \section{Changes in version 0.9-57}{
 	\itemize{
     \item{ svKomodo creates now at loading a \code{.Last.sys()} function in

Modified: pkg/svKomodo/man/svKomodo-package.Rd
===================================================================
--- pkg/svKomodo/man/svKomodo-package.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svKomodo/man/svKomodo-package.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -13,8 +13,8 @@
   \tabular{ll}{
     Package: \tab svKomodo\cr
     Type: \tab Package\cr
-    Version: \tab 0.9-57\cr
-    Date: \tab 2012-04-22\cr
+    Version: \tab 0.9-58\cr
+    Date: \tab 2012-06-22\cr
     License: \tab GPL 2 or above, at your convenience\cr
   }
   % TODO: add description of main functions here. Also add examples

Modified: pkg/svMisc/DESCRIPTION
===================================================================
--- pkg/svMisc/DESCRIPTION	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/DESCRIPTION	2012-07-02 13:45:55 UTC (rev 482)
@@ -1,7 +1,7 @@
 Package: svMisc
 Type: Package
-Version: 0.9-65
-Date: 2012-03-31
+Version: 0.9-66
+Date: 2012-07-01
 Title: SciViews GUI API - Miscellaneous functions
 Authors at R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
   email = "phgrosjean at sciviews.org"),

Modified: pkg/svMisc/NAMESPACE
===================================================================
--- pkg/svMisc/NAMESPACE	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/NAMESPACE	2012-07-02 13:45:55 UTC (rev 482)
@@ -9,6 +9,7 @@
        Args,
        argsTip,
        assignTemp,
+       batch,
        CallTip,
        callTip,
        changeTemp,
@@ -36,6 +37,7 @@
        helpSearchWeb,
        isAqua,
        isHelp,
+       isJGR,
        isMac,
        isRgui,
        isSDI,

Modified: pkg/svMisc/NEWS
===================================================================
--- pkg/svMisc/NEWS	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/NEWS	2012-07-02 13:45:55 UTC (rev 482)
@@ -1,5 +1,12 @@
 = svMisc News
 
+== Changes in svMisc 0.9-66
+
+* Added function isJGR().
+
+* Added batch processing function batch().
+
+
 == Changes in svMisc 0.9-65
 
 * Partial argument matching in completion(), progress() and rmTemp() code fixed.

Added: pkg/svMisc/R/batch.R
===================================================================
--- pkg/svMisc/R/batch.R	                        (rev 0)
+++ pkg/svMisc/R/batch.R	2012-07-02 13:45:55 UTC (rev 482)
@@ -0,0 +1,45 @@
+batch <- function (  # A test batch process...
+	### This batch process runs fakeProc() on ten files,
+	### we want a complete and readable log of the whole process at the end!
+items,	##<< a list of items to process with \code{fun}
+fun,	##<< the function to be run in batch mode
+...,	##<< further arguments passed to the process function
+show.progress = !isAqua() && !isJGR(),	##<< whether we display a progression message
+suppress.messages = show.progress)	##<< do we suppress simple messages?
+{
+	if (!is.function(fun)) stop("'fun' must be a function")
+	
+	## Preparation of the batch process...
+	owarn <- options(warn = 1) # Issue warnings immediatelly!
+	on.exit(options(owarn))
+	message("Running the batch process with ", deparse(substitute(fun)), "...")
+	n <- length(items)
+	if (n < 1) {
+		warning("No items to process!")
+		return(invisible(structure(FALSE, items = items, ok = logical(0))))
+	}
+	ok <- rep(NA, n) # A vector with results
+	
+	## Do we show progression?
+	if (!isTRUE(show.progress))
+		progress <- function (...) return() # Fake progress() function
+	if (!isTRUE(suppress.messages))
+		suppressMessages <- function (x) return(x) # Fake suppressMessages() function
+	
+	## Run fun() for each item
+	flush.console()
+	for (i in 1:n) {
+		progress(i, n)
+		item <- items[i]
+		ok[i] <- as.logical(suppressMessages(fun(item, ...)))[1]
+		flush.console()
+	}
+	progress(n + 1, n) # Cancel progression message
+	message("Processed successfully ", sum(ok, na.rm = TRUE), " items on ", n, " (see .last.batch)")
+	## Record .last.batch variable in TempEnv
+	lastBatch <- structure(sum(ok, na.rm = TRUE) == n, items = items, ok = ok)
+	assignTemp(".last.batch", lastBatch)
+	return(invisible(lastBatch))
+	### returns invisibly \code{TRUE} if all files were processed succesfully,
+	### otherwise, return \code{FALSE} invisibly
+}

Added: pkg/svMisc/R/isJGR.R
===================================================================
--- pkg/svMisc/R/isJGR.R	                        (rev 0)
+++ pkg/svMisc/R/isJGR.R	2012-07-02 13:45:55 UTC (rev 482)
@@ -0,0 +1,2 @@
+isJGR <- function ()
+	("package:JGR" %in% search())

Added: pkg/svMisc/man/batch.Rd
===================================================================
--- pkg/svMisc/man/batch.Rd	                        (rev 0)
+++ pkg/svMisc/man/batch.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -0,0 +1,51 @@
+\name{batch}
+\alias{batch}
+
+\title{ Run a function in batch mode }
+\description{
+  A function can be run in batch mode if it never fails (replace errors by
+  warnings) and return \code{TRUE} in case of success, or \code{FALSE}
+  otherwise.
+}
+
+\usage{
+batch(items, fun, ..., show.progress = !isAqua() && !isJGR(),
+    suppress.messages = show.progress)
+}
+
+\arguments{
+  \item{items}{ the items (usually, arguments vector of character strings) on
+    which to apply \code{fun} sequentially. }
+  \item{fun}{ the function to run (must return \code{TRUE} or \code{FALSE} and
+    issue only warnings and messages to be a good candidate, batchable, function). }
+  \item{\dots}{ further arguments to pass the \code{fun}. }
+  \item{show.progress}{ do we show progression as item x on y... message? This
+    uses the \code{progress()} function. }
+  \item{suppress.messages}{ are messages from the batcheable function suppressed?
+    Only warnings will be issued. Recommended if \code{show.progress = TRUE}. }
+}
+
+\author{ Philippe Grosjean <phgrosjean at sciviews.org> }
+
+\seealso{\code{\link{progress}}}
+
+\examples{
+## Here is a fake batcheable process
+fakeProc <- function (file) {
+    message("Processing ", file, "...")
+    flush.console()
+    Sys.sleep(1)
+    if (runif(1) > 0.7) { # Fails
+        warning("fakeProc was unable to process ", file)
+        return(invisible(FALSE))
+    } else return(invisible(TRUE))
+}
+
+## Run it in batch mode on five items
+files <- paste("file", 1:5, sep = "")
+batch(files, fakeProc)
+}
+
+\keyword{ utilities }
+
+\concept{ batch processing }

Modified: pkg/svMisc/man/isAqua.Rd
===================================================================
--- pkg/svMisc/man/isAqua.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/man/isAqua.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -18,7 +18,7 @@
 
 \author{ Philippe Grosjean <phgrosjean at sciviews.org> }
 
-\seealso{ \code{\link{isMac}}, \code{\link{isRgui}} }
+\seealso{ \code{\link{isMac}}, \code{\link{isRgui}}, \code{\link{isJGR}} }
 
 \examples{
 isAqua()

Added: pkg/svMisc/man/isJGR.Rd
===================================================================
--- pkg/svMisc/man/isJGR.Rd	                        (rev 0)
+++ pkg/svMisc/man/isJGR.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -0,0 +1,27 @@
+\name{isJGR}
+\alias{isJGR}
+
+\title{ Is R running with the JGR GUI? }
+\description{
+  Determine if the R GUI is JGR.
+}
+
+\usage{
+isJGR()
+}
+
+\value{
+  \code{TRUE} if the R GUI is JGR, \code{FALSE} otherwise.
+}
+
+\author{ Philippe Grosjean <phgrosjean at sciviews.org> }
+
+\seealso{ \code{\link{isMac}}, \code{\link{isAqua}}, \code{\link{isRgui}} }
+
+\examples{
+isJGR()
+}
+
+\keyword{ utilities }
+
+\concept{ OS system platform }

Modified: pkg/svMisc/man/isMac.Rd
===================================================================
--- pkg/svMisc/man/isMac.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/man/isMac.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -17,7 +17,7 @@
 
 \author{ Philippe Grosjean <phgrosjean at sciviews.org> }
 
-\seealso{ \code{\link{isWin}}, \code{\link{isAqua}} }
+\seealso{ \code{\link{isWin}}, \code{\link{isAqua}}, \code{\link{isJGR}} }
 
 \examples{
 isMac()

Modified: pkg/svMisc/man/isRgui.Rd
===================================================================
--- pkg/svMisc/man/isRgui.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/man/isRgui.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -18,7 +18,7 @@
 
 \author{ Philippe Grosjean <phgrosjean at sciviews.org> }
 
-\seealso{ \code{\link{isSDI}}, \code{\link{isWin}} }
+\seealso{ \code{\link{isSDI}}, \code{\link{isWin}}, \code{\link{isJGR}} }
 
 \examples{
 isRgui()

Modified: pkg/svMisc/man/isWin.Rd
===================================================================
--- pkg/svMisc/man/isWin.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/man/isWin.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -16,7 +16,7 @@
 
 \author{ Philippe Grosjean <phgrosjean at sciviews.org> }
 
-\seealso{ \code{\link{isMac}}, \code{\link{isRgui}} }
+\seealso{ \code{\link{isMac}}, \code{\link{isRgui}}, \code{\link{isJGR}} }
 
 \examples{
 isWin()

Modified: pkg/svMisc/man/progress.Rd
===================================================================
--- pkg/svMisc/man/progress.Rd	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svMisc/man/progress.Rd	2012-07-02 13:45:55 UTC (rev 482)
@@ -59,6 +59,8 @@
 
 \author{ Philippe Grosjean <phgrosjean at sciviews.org> }
 
+\seealso{\code{\link{batch}}}
+
 \note{ In a GUI, it is preferable to use a non modal dialog box with a progress
 widget, or to display such a progress widget in the status bar of your main
 window. }

Modified: pkg/svTools/NAMESPACE
===================================================================
--- pkg/svTools/NAMESPACE	2012-06-11 12:33:55 UTC (rev 481)
+++ pkg/svTools/NAMESPACE	2012-07-02 13:45:55 UTC (rev 482)
@@ -23,7 +23,7 @@
        searchPackage,
        searchWiki,
        sidekick)
-# Currently hidden, but my be exported in the future
+# Currently hidden, but may be exported in the future
 #       addError,
 #       emptyError,
 #       getErrors,



More information about the Sciviews-commits mailing list