[This article was first published on   Mirai Solutions, 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.
            
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
We are pleased to announce the release of XLConnect 0.2-14, now available from CRAN and from our GitHub repository.
< !--more-->This release is mainly a maintenance release and comes with the following changes:
- Upgrade to Apache POI 3.17
- Upgraded XLConnectJars dependency to version 0.2-14
- Fixed Java version specification in system requirements
- Checking Java version at runtime according to CRAN requirements
- Added existsCellStyleto check for existence of cell styles (#71)
- Added getOrCreateCellStylecombinator (#14, #71)
- Updates to vignettes: The XLConnect Package, XLConnect for the Impatient
The following example illustrates the use of XLConnect to produce a simple report:
require(XLConnect)
# Create new Excel workbook
wb <- loadWorkbook("earthquakes.xlsx", create = TRUE)
# Create worksheet to hold data
targetSheet <- "Earthquakes"
createSheet(wb, name = targetSheet)
# Export earthquake data
writeWorksheet(wb, data = quakes, sheet = targetSheet)
# Create cell style to color events with a magnitude >= 6.0 on the
# Richter scale
largeMagnitudeStyle <- getOrCreateCellStyle(wb, name = "Large Magnitude")
# Use solid red foreground to color rows
setFillForegroundColor(largeMagnitudeStyle, color = XLC$COLOR.RED)
setFillPattern(largeMagnitudeStyle, fill = XLC$FILL.SOLID_FOREGROUND)
# Determine large magnitude earthquakes
rowIdx <- which(quakes$mag >= 6.0)
# Color rows accordingly
# NOTE: Since we include a header row in the worksheet
# we need to offset the row indices by 1!
setCellStyle(wb, sheet = targetSheet, 
             row = rep(rowIdx + 1, each = ncol(quakes)),
             col = rep_len(seq_len(ncol(quakes)), length(rowIdx)),
             cellstyle = largeMagnitudeStyle)
# Save workbook
saveWorkbook(wb)
< !--more-->
XLConnect is a comprehensive and cross-platform R package for manipulating Microsoft Excel files from within R. 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).
To leave a comment for the author, please follow the link and comment on their blog:  Mirai Solutions.
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.
