[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.
XLConnect 1.0.1 now available from CRAN and from our GitHub repository.
We are pleased to announce the release of XLConnect 1.0.1. This release is mainly a maintenance release and comes with the following changes:
- Upgrade to Apache POI 4.1
- Adapt Java implementation to make use of Java 8 and remove some dependencies
- Remove dependency on XLConnectJars, download required jars at installation time
The following example illustrates the use of XLConnect to produce a simple report:
require(XLConnect)# Create new Excel workbookwb<-loadWorkbook("cities.xlsx",create=TRUE)# Create worksheet to hold datatargetSheet<-"Cities"createSheet(wb,name=targetSheet)# Export city datawriteWorksheet(wb,data=boot::bigcity,sheet=targetSheet)# Create cell style to color events with a magnitude >= 6.0 on the# Richter scalehighGrowthStyle<-getOrCreateCellStyle(wb,name="High Growth")# Use solid red foreground to color rowssetFillForegroundColor(highGrowthStyle,color=XLC$COLOR.GREEN)setFillPattern(highGrowthStyle,fill=XLC$FILL.SOLID_FOREGROUND)# Determine high growth citiesgrowth<-boot::bigcity$x/boot::bigcity$u# value is for upper quartilerowIdx<-which(growth>=1.4410)# 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(boot::bigcity)),col=rep_len(seq_len(ncol(boot::bigcity)),length(rowIdx)),cellstyle=highGrowthStyle)# Save workbooksaveWorkbook(wb)
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).
var vglnk = { key: '949efb41171ac6ec1bf7f206d57e90b8' }; (function(d, t) {var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;s.src = '//cdn.viglink.com/api/vglnk.js';var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r); }(document, 'script'));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.