Posts

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.htmlxplain cheat sheet (PDF): http://www.zuckarelli.de/xplain/xplain_cheatsheet.pdfxplain on CRAN: https://cran.r-project.org/package=xplainxplain on GitHub: https://www.github.com/jsugarelli/xplainxplain example XML files: http://www.zuckarelli.de/xplain/example_lm.xml and http://www.zuckarelli.de/xplain/example_lm_foreach.xml

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

OverviewR’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: install.packages("pointr", dep…

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 doesxml2relational 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 easily into a relational data…

A switch-case construct for the R language

Introduction
In contrast to many other programming languages, R has no real native switch-case statement. It does provide the primitive switch() function; but switch() is actually made to select elements from a list based on their name or index position. It cannot (at least not without awkward workarounds) be used to build conditions with more complex comparison values. Also, when fed with a numeric expression, it interprets the expression as an index and selects the element from the list at this index position. This is not useful when you want to test an expression against another numeric expression/value.

It would be good to have an efficient way of testing multiple, similar conditions, including conditions that are more complex in their comparison values or result in numeric values. At the same time nested if-else constructs should be avoided because they make the code less clear and readable.

The switchcase package provides a solution by offering a true switch-case construct for …

New article on R package development (in German)

Recently, I published an article in the German online magazine 'Informatik Aktuell' about R package development. It is a pragmatic introduction to contributing your own packages to R and works with a simple example package that is developed from A to Z in the article. The code of this example package (tempconvertr) can also be found in a GitHub repo at https://github.com/jsugarelli/tempconvertr.

Read the full article here (in German): https://www.informatik-aktuell.de/entwicklung/programmiersprachen/r-packages-entwickeln.html.