XLConnect 0.1-8

February 16, 2012
By

(This article was first published on Mirai Solutions » R, and kindly contributed to R-bloggers)

Mirai Solutions GmbH (http://www.mirai-solutions.com) is pleased to announce the availability of XLConnect 0.1-8 on CRAN.

The most prominent new features/extensions are an improved package vignette which provides more information and examples to get people started with the package. A new type conversion mechanism was introduced which allows users to pre-specify column types/classes and even force conversions between types (e.g. from character to numeric) when reading in data using readNamedRegion or readWorksheet. Instead of relying completely on cell types (which is the default mechanism), this allows to specify column classes of the data to be read in upfront. Possible type conversion issues will be reported back to the user/developer via warnings referring to the actual cell that is causing problems. Another new feature that was introduced is the function xlcEdit. It allows to edit plain data.frames in an Excel file editor (e.g. MS Excel). Changes will be applied to the underlying data object after closing the editor. Note that this functionality is only available under Windows and Mac OS X. For more information please see the reference manual.

A summary of news in XLConnect 0.1-8 can be found in the NEWS file on CRAN.

The following is a simple example showing the type conversion mechanism introduced with XLConnect 0.1-8:

# Load the XLConnect package
require(XLConnect)

# conversion xlsx file from demoFiles subfolder of package XLConnect
excelFile <- system.file("demoFiles/conversion.xlsx", package = "XLConnect")

# Load workbook
wb <- loadWorkbook(excelFile)

# Read named region 'conversion' with pre-specified column types
# Note: in the worksheet all data was entered as strings!
# forceConversion = TRUE is used to force conversion from String
# into the less generic data types numeric, POSIXt & logical
df <- readNamedRegion(wb, name = "conversion", header = TRUE,
		colTypes = c("numeric", "POSIXt", "logical"),
		forceConversion = TRUE,
		dateTimeFormat = "%Y-%m-%d %H:%M:%S")

# print classes
print(sapply(df, class))

XLConnect is a comprehensive and cross-platform R package for manipulating Microsoft Excel files from within R. XLConnect differs from other related R packages in that it is completely cross-platform and as such runs under Windows, Unix/Linux and Mac (32- and 64-bit). Moreover, it does not require any installation of Microsoft Excel or any other special drivers to be able to read & write Excel files. The only requirement is a recent version of a Java Runtime Environment (JRE).

The package can easily be installed from CRAN via install.packages("XLConnect"). In order to get started have a look at the package vignette, the numerous demos available via demo(package = "XLConnect") or browse through the comprehensive reference manual.

We are always happy to hear from you! For general feedback write us an email to [email protected]. If you find any bugs or hope to see some currently missing features in the future, just send us an email to [email protected]. You may also want to check out our XLConnect FAQ.


To leave a comment for the author, please follow the link and comment on his blog: Mirai Solutions » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.