Posts

Converting XML data to R dataframes with xmlconvert

Image
The  xmlconvert  package is made to easily and comfortably convert XML data to R dataframes and the other way around. It provides a lot of options to control the conversion process and to export the results to CSV or Excel files, if desired. How you install  xmlconvert Just execute  install.packages ("x mlconvert", dependencies = TRUE)  in the R console to install the package including all packages it depends on. By default, the  xlsx  package for writing Excel files is not installed together with  xmlconvert .  xmlconvert  will tell you when you need  xlsx  and will ask you to install it then. How you work with  xmlconvert The functions  xml_to_df()  and  df_to_xml()  are the two workhorses of the package. The functions assume that each data record (e.g. a customer) in the XML data is stored in one XML element/tag; the individual fields (e.g. name, address, e-mail), however, can be represente...

packagefinder now with RStudio add-in

Image
A new version 0.3.0 of the packagefinder package is now available on CRAN. It comes with a new add-in for R Studio that provides a graphical interface to the findPackage() and whatsNew() functions. Finding packages on CRAN is now easier and more comfortable than ever! Here are some impressions.   Install the package from CRAN with install.packages("packagefinder", dependencies = TRUE) The add-in is installed automatically when you install the package. It can be started from the Addins dropdown menu on the RStudio toolbar.  See the packagefinder source code on GitHub . Star and fork the repo! And don't forget to follow me on Twitter to receive more updatates on all my packages and R activities!

New 0.2.2 version of xplain

A new version of my package xplain has been released. xplain is a technology that allows  to provide live interpretations and explanations of statistical functions and their results to R learners.   It now supports the use of  xplain XML files from HTTPS addresses. Since the xplain uses the XML package to process the XML files,  and the XML packages requires R 4.0.0 or higher, xplain depends now on R >= 4.0.0. However, I am going to migrate xplain to xml2 in then near future, so that it works with R versions below 4.0.0. To learn more about xplain : xplain  web tutorial:  http://www.zuckarelli.de/xplain/index.html xplain cheat sheet (PDF):  http://www.zuckarelli.de/xplain/xplain_cheatsheet.pdf xplain on CRAN:  https://cran.r-project.org/package=xplain xplain on GitHub:  https://www.github.com/jsugarelli/xplain xplain example XML files:  http://www.zuckarelli.de/xplain/example_lm.xml  and  http://www.zuckarelli.de...

New flatxml package version: Now also converts dataframes to XML

flatxml version 0.1.0 now available on CRAN The new version of my R package packagefinder now has a function fxml_toXML() which converts a dataframe into XML code. This complements the already existing fxml_toDataFrame() function that transforms an XML document into a dataframe. The package can be installed from CRAN  (just type install.packagebs("flatxml", dependencies = TRUE)   into the R console). Its source code is avaible on GitHub:  https://github.com/jsugarelli/flatxml . For detailed information on how to work with flatxml , please refer to the package's homepage https://www.zuckarelli.de/flatxml/index.html . 

New video on my 'switchcase' R package

Image
In a new YouTube video (16 mins) I explain my recently published  switchcase package and the difference between its switchCase() function and R's primitive switch() function. Watch the video and visit the GitHub repo on  https://github.com/jsugarelli/switchcase to learn more .

Pointers/shortcuts in R with the ‘pointr’ package

Overview R’s built-in copy-on-modify behavior prevents the user from having two symbols always pointing to the same object. Because pointers, as they are common in other programming languages, are essentially symbols (variables) related to an object that has already another symbol attached to it, it is clear that pointers do not fit naturally into R’s language concept. However, pointers would be indredibly useful, e.g. when you work with complex subsets of dataframes. These complex filtering conditions make the code harder to read and to maintain. For this reason, it would be good to have a kind of ‘abbreviation’ or ‘shortcut’ that lets you write such filtering conditions more efficiently. Thepointr package provides functionality to create pointers to any R object easily, including pointers to subsets/selections from dataframes.  Working with  pointr Installing and loading  pointr To install the CRAN version of  pointr  from the R console, just call: ...

The xml2relational package: Transforming NoSQL to relational data

Usually it is easier to work with data when you have them in a tabular, relational format. Often enough however, we only get the data in an object-oriented, NoSQL data format like XML or JSON. So there is a need to transform NoSQL data to something that is easier to work with. This is where my new package  xml2relational  comes into play.  What xml2relational does xml2relational is designed to convert XML documents with nested object hierarchies into a set of R dataframes. These dataframes represent the different tables in a relational data model and are connected amongst each other by foreign keys. Essentially, xml2relational flattens an object-oriented data structure into a relational data structure. Once the relational structure is created (and that is basically a list of dataframes representing the different tables) you can export both the data model (as SQL CREATE statements) and the data (either as SQL INSERT statements or as CSV files) to get the data eas...