Spreadsheets – a Renjin package – Released

I released spreadsheets under the MIT license two weeks ago. Spreadsheets is a package (extension) for Renjin (an implementation of R for the Java Virtual Machine). This package will give you the ability to work with (read, write) spreadsheets. It supports reading of excel and Open Office/Libre Office spreadsheets files. The project is located on github.

To import a spreadsheet into a data.frame you just do:

excelDf <- importSpreadsheet(
    filePath = "df.xlsx",
    sheet = 1,
    startRow = 2,
    endRow = 34,
    startColumn = 1,
    endColumn = 11,
    firstRowAsColumnNames = TRUE

Similarly to export a data.frame to a spreadsheet (Excel or Open Document) is as simple as:

exportSpreadsheet(filePath, df, sheet)

You can also export several data.frame to a spreadsheet in one go:

  filePath = paste0(getwd(), "/dfExport.ods"), 
  dfList = list(mtcars, iris, PlantGrowth), 
  sheetNames = c("cars", "flowers", "plants")

In addition there are several nice utility function such as find a row or a column matching a given value, convert between column indexes and names etc.

xmlr released on CRAN

Xmlr is a R packed providing an object oriented approach to XML management for R written in R’s Reference Classes. The project is located at github and available for free under the MIT license. It was accepted by CRAN May 12 2020.

To create the following xml

<table xmlns='http://www.w3.org/TR/html4/'>

You could do something like this:

 doc <- Document$new()
  root <- Element$new("table")
  root$setAttribute("xmlns", "http://www.w3.org/TR/html4/")


Or you could do like this:

doc2 <- parse.xmlstring("
<table xmlns='http://www.w3.org/TR/html4/'>