XLConnect 0.1-8

[This article was first published on Mirai Solutions » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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 their blog: Mirai Solutions » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)