[R-gregmisc-users] SF.net SVN: r-gregmisc:[1406] trunk/gdata/R
                
                Brought to you by:
                
                    warnes
                    
                
            
            
        
        
        
    | 
      
      
      From: <wa...@us...> - 2010-01-24 19:13:29
      
     | 
| Revision: 1406
          http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1406&view=rev
Author:   warnes
Date:     2010-01-24 19:13:22 +0000 (Sun, 24 Jan 2010)
Log Message:
-----------
Make read.xls() and xls2sep() quieter when verbose=FALSE
Modified Paths:
--------------
    trunk/gdata/R/read.xls.R
    trunk/gdata/R/xls2sep.R
Modified: trunk/gdata/R/read.xls.R
===================================================================
--- trunk/gdata/R/read.xls.R	2010-01-24 19:12:07 UTC (rev 1405)
+++ trunk/gdata/R/read.xls.R	2010-01-24 19:13:22 UTC (rev 1406)
@@ -25,8 +25,6 @@
     {
       if(verbose)
         cat("Reading", method, "file ", dQuote.ascii(tfn), "...\n")
-      else
-        cat("Reading", method, "file... ")
       
       if(method=="csv")
         retval <- read.csv(con, ...)
@@ -35,23 +33,24 @@
       else
         stop("Unknown method", method)
         
-      cat("Done.\n")
+      if(verbose)
+        cat("Done.\n")
     }
   else {
-    cat("Searching for lines containing pattern ", pattern, "... ")
+    if(verbose)
+      cat("Searching for lines containing pattern ", pattern, "... ")
     idx <- grep(pattern, readLines(con))
     if (length(idx) == 0) {
       warning("pattern not found")
       return(NULL)
     }
-    cat("Done.\n")
+   if(verbose)
+     cat("Done.\n")
     
     seek(con, 0)
 
     if(verbose)
       cat("Reading", method, "file ", dQuote.ascii(tfn), "...\n")
-    else
-      cat("Reading", method, "file... ")       
 
     if(method=="csv")
       retval <- read.csv(con, skip = idx[1]-1, ...)
@@ -62,7 +61,8 @@
 
     close(con)
 
-    cat("Done.\n")     
+    if(verbose)
+      cat("Done.\n")     
   }
   retval
 }
Modified: trunk/gdata/R/xls2sep.R
===================================================================
--- trunk/gdata/R/xls2sep.R	2010-01-24 19:12:07 UTC (rev 1405)
+++ trunk/gdata/R/xls2sep.R	2010-01-24 19:13:22 UTC (rev 1406)
@@ -35,10 +35,8 @@
           cat("Downloading",
               dQuote.ascii(xls), " to ",
               dQuote.ascii(tf), "...\n")
-        else
-          cat("Downloading...\n")
         download.file(xls, tf, mode = "wb")
-        cat("Done.\n")
+        if(verbose) cat("Done.\n")
         xls <- tf
       }
 
@@ -88,8 +86,6 @@
         cat("   ", dQuote.ascii(targetFile), "\n")
         cat("... \n\n")
       }
-    else
-      cat("Converting xls file to", method, "file... ")         
     
     ##
     ## do the translation
@@ -104,7 +100,7 @@
     if(file.access(targetFile, 4)!=0)
       stop("Unable to read translated ", method, " file '", targetFile, "'." )
     
-    cat("Done.\n")
+    if (verbose) cat("Done.\n")
 
     
     ## prepare for cleanup now, in case of error reading file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |