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

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

Read the full article here (in German):

New version of package 'packagefinder' with improved ranking of search results

A new version (0.1.5) of my 'packagefinder' package is now available on CRAN. The main change is an imroved ranking mechanism for search results that delivers more relevant results. Apart from that, a new shortcut function fp() is available that saves typing work when calling findPackage().

The 'packagefinder' package is designed to search for packages on CRAN directly from the R console with ease and comfort.

Learn more about the 'packagefinder' package...
on CRAN: GitHub: YouTube: the web (tutorial): Follow me on Twitter:

Finding CRAN packages right from the R console (new packagefinder version)

A new version of my package packagefinder is available on CRAN. It has a lot of new features and comes with a YouTube tutorial.

What is packagefinder? How does it benefit me? Currently, there are more than 14,000 R package contributions on CRAN providing R with an unparalleled wealth of features. The downside of the large and increasing amount of packages is that it becomes increasingly difficult to find the right tools to tackle a specific problem. Unfortunately, CRAN does not provide any good search functionality.

packagefinder is designed to search for CRAN packages right from the R console. The philosophy behind this package is that R users like using the R console and need a tool to do their day-to-day-work on CRAN without leaving their normal workspace, the console. In fact, the idea is that with packagefinder you do not need to leave the R console to work with CRAN effectively.

packagefinder is developed to save you time and energy finding the right packages to work with, thereby…

New R package 'debugr' - use automatic debug messages to improve your code

debugr is a new package designed to support debugging in R. It mainly provides the dwatch() function which prints a debug output to the console or to a file. A debug output can consist of a static text message, the values of one or more objects (potentially transformed by applying some functions) or the value of one or multiple (more complex) R expressions.

Whether or not a debug message is displayed can be made dependent on the evaluation of a criterion phrased as an R expression. Generally, debug messages are only shown if the debug mode is activated. The debug mode is activated and deactivated with debugr_switchOn() and debugr_switchOff(), respectively, which change the logical value in the global options. Since debug messages are only displayed in debug mode, the dwatch() function calls can even remain in the original code as they remain silent and won't have any effect until the debug mode is switched on again.

Read more:

The package's vignette: https://cloud…