[Swift-commit] r4370 - SwiftApps/SwiftR/Swift/R

tga at ci.uchicago.edu tga at ci.uchicago.edu
Wed Apr 13 14:02:50 CDT 2011


Author: tga
Date: 2011-04-13 14:02:50 -0500 (Wed, 13 Apr 2011)
New Revision: 4370

Modified:
   SwiftApps/SwiftR/Swift/R/Export.R
Log:
Added quiet option for swiftExport.  By default doesn't print out info about
file location.


Modified: SwiftApps/SwiftR/Swift/R/Export.R
===================================================================
--- SwiftApps/SwiftR/Swift/R/Export.R	2011-04-13 19:01:15 UTC (rev 4369)
+++ SwiftApps/SwiftR/Swift/R/Export.R	2011-04-13 19:02:50 UTC (rev 4370)
@@ -46,7 +46,9 @@
     swiftExport(list=ls(globalenv()), file=file)
 }
 
-swiftExport <- function (..., list=NULL, file=NULL) {
+swiftExport <- function (..., list=NULL, file=NULL, 
+        quiet=getOption("swift.quiet")) {
+    if (is.null(quiet)) quiet <- TRUE
     # List of object names (as R symbols or as strings)
     # These will be passed directly to save() to be serialized
     if (is.null(file)) {
@@ -59,7 +61,7 @@
         }
         # Separate directory for each new R session to keep files together
         # and avoid conflicts.
-        cat("Export directory: ", dir, "\n")
+        if (!quiet)    cat("Export directory: ", dir, "\n")
         dir.create(dir, recursive=T, showWarnings=FALSE, mode=kDIR_MODE)
 
         # add the file, keeping a counter to use in the file name
@@ -67,7 +69,7 @@
         if (is.null(expid)) expid = 0
         options(.swift.exportid = expid + 1)
         file <- file.path(dir, sprintf("E%.7d",expid))
-        cat("Export file: ", file, "\n")
+        if (!quiet)    cat("Export file: ", file, "\n")
         
         # Keep track of files for later cleanup
         expfiles <- getOption(".swift.exportfiles")




More information about the Swift-commit mailing list