[R-gregmisc-users] SF.net SVN: r-gregmisc:[1382] trunk/gdata/R/sheetCount.R
Brought to you by:
warnes
From: <wa...@us...> - 2010-01-23 05:45:19
|
Revision: 1382 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1382&view=rev Author: warnes Date: 2010-01-23 05:45:13 +0000 (Sat, 23 Jan 2010) Log Message: ----------- Add sheetNames() function to extract the names from XLS files Modified Paths: -------------- trunk/gdata/R/sheetCount.R Modified: trunk/gdata/R/sheetCount.R =================================================================== --- trunk/gdata/R/sheetCount.R 2010-01-23 05:23:22 UTC (rev 1381) +++ trunk/gdata/R/sheetCount.R 2010-01-23 05:45:13 UTC (rev 1382) @@ -1,4 +1,10 @@ sheetCount <- function(xls, verbose = FALSE, perl = "perl") + sheetCmd(xls, cmd="sheetCount.pl", verbose=verbose, perl=perl) + +sheetNames <- function(xls, verbose = FALSE, perl = "perl") + sheetCmd(xls, cmd="sheetNames.pl", verbose=verbose, perl=perl) + +sheetCmd <- function(xls, cmd="sheetCount.pl", verbose=FALSE, perl="perl") { ## @@ -27,7 +33,7 @@ } ## - sc <- file.path(perl.dir,'sheetCount.pl') + sc <- file.path(perl.dir, cmd) ## ## @@ -49,10 +55,14 @@ } ## results <- system(cmd, intern=TRUE) + tc <- textConnection(results) + results <- read.table(tc, as.is=TRUE, header=FALSE) + results <- unlist(results) + names(results) <- NULL ## if (verbose) cat("Done.\n\n") - as.numeric(results) + results } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |