[R-gregmisc-users] SF.net SVN: r-gregmisc:[1395] trunk/gdata/man
Brought to you by:
warnes
From: <wa...@us...> - 2010-01-24 08:15:17
|
Revision: 1395 http://r-gregmisc.svn.sourceforge.net/r-gregmisc/?rev=1395&view=rev Author: warnes Date: 2010-01-24 08:15:10 +0000 (Sun, 24 Jan 2010) Log Message: ----------- Add/Update documentation Modified Paths: -------------- trunk/gdata/man/read.xls.Rd Added Paths: ----------- trunk/gdata/man/sheetCount.Rd Modified: trunk/gdata/man/read.xls.Rd =================================================================== --- trunk/gdata/man/read.xls.Rd 2010-01-24 08:06:23 UTC (rev 1394) +++ trunk/gdata/man/read.xls.Rd 2010-01-24 08:15:10 UTC (rev 1395) @@ -2,21 +2,22 @@ \alias{read.xls} \alias{xls2csv} \alias{xls2tab} +\alias{xls2tsv} \alias{xls2sep} \title{Read Excel files} -\description{Reads a Microsoft Excel file into a data frame} +\description{Read a Microsoft Excel file into a data frame} \usage{ -read.xls(xls, sheet=1, verbose=FALSE, pattern, ..., - method=c("csv","tab"), perl="perl") - +read.xls(xls, sheet = 1, verbose=FALSE, pattern, ..., + method=c("csv","tsv","tab"), perl="perl") xls2csv(xls, sheet=1, verbose=FALSE, ..., perl="perl") xls2tab(xls, sheet=1, verbose=FALSE, ..., perl="perl") -xls2sep(xls, sheet=1, verbose=FALSE, ..., method=c("csv","tab"), +xls2tsv(xls, sheet=1, verbose=FALSE, ..., perl="perl") +xls2sep(xls, sheet=1, verbose=FALSE, ..., method=c("csv","tsv","tab"), perl="perl") } \arguments{ - \item{xls}{path to the Microsoft Excel file. To access a file on the - internet, start the path with "http://".} + \item{xls}{path to the Microsoft Excel file. Supports "http://", + "https://", and "ftp://" URLS.} \item{sheet}{number of the sheet within the Excel file from which data are to be read} \item{verbose}{logical flag indicating whether details should be @@ -93,14 +94,34 @@ crime <- read.xls(crime.url, pattern = "State") # use of xls2csv - open con, print two lines, close con - con <- xls2csv(nba.url) + con <- xls2csv(crime.url) print(readLines(con, 2)) file.remove(summary(con)$description) } + + # Examples demonstrating selection of specific 'sheets' + # from the example XLS file 'ExampleExcelFile.xls' + exampleFile <- file.path(.path.package('gdata'),'xls', + 'ExampleExcelFile.xls') + exampleFile2007 <- file.path(.path.package('gdata'),'xls', + 'ExampleExcelFile.xlsx') + + # see the number and names of sheets: + sheetCount(exampleFile) + sheetNames(exampleFile2007) + + data <- read.xls(exampleFile) # default is first worksheet + data <- read.xls(exampleFile, sheet=2) # second worksheet by number + data <- read.xls(exampleFile, sheet="Sheet Second",v=T) # and by name + + # load the third worksheet, skipping the first two non-data lines... + data <- read.xls(exampleFile2007, sheet="Sheet with initial text", skip=2) + } -\author{Jim Rogers \email{jam...@pf...}, modified - and extended by Gregory R. Warnes \email{gr...@ra...} +\author{ + Gregory R. Warnes \email{gr...@ra...}, + Jim Rogers \email{jam...@pf...}, and Gabor Grothendiek \email{ggr...@gm...}. } \keyword{file} Added: trunk/gdata/man/sheetCount.Rd =================================================================== --- trunk/gdata/man/sheetCount.Rd (rev 0) +++ trunk/gdata/man/sheetCount.Rd 2010-01-24 08:15:10 UTC (rev 1395) @@ -0,0 +1,47 @@ +\name{sheetCount} +\Rdversion{1.1} +\alias{sheetCount} +\alias{sheetNames} +\title{ +Count or list sheet names in Excel spreadsheet files. +} +\description{ +Count or list sheet names in Excel spreadsheet files. +} +\usage{ +sheetCount(xls, verbose = FALSE, perl = "perl") +sheetNames(xls, verbose = FALSE, perl = "perl") +} +\arguments{ + \item{xls}{File path to spreadsheet. Supports "http://", + "https://", and "ftp://" URLS.} + \item{verbose}{If \code{TRUE}, show additional messages during + processing.} + \item{perl}{Path to perl interpreter.} +} +\value{ + \code{sheetCount} returns the number of sheets in the spreadsheet. + \code{sheetNames} returns the names of sheets in the spreadsheet. +} + +\seealso{ + \code{\link{read.xls}}, \code{\link{xls2csv}}. +} +\examples{ + xlsfile <- system.file("xls", "iris.xls", package = "gdata") + xlsfile + + sheetCount(xlsfile) + + + exampleFile <- file.path(.path.package('gdata'),'xls', + 'ExampleExcelFile.xls') + exampleFile2007 <- file.path(.path.package('gdata'),'xls', + 'ExampleExcelFile.xlsx') + + sheetCount(exampleFile) + sheetNames(exampleFile2007) + + +} +\keyword{ misc } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |