Using R 4.1.0 and R 4.0.5 on MacOS using RSwitch

Lately R version 4.1.0 was released on CRAN (see https://cran.r-project.org).

The MacOS version was one day late. But yesterday it was released, too. So I wanted to test the new version without being able to go back. “No problem”, I thought “I’m already using RSwitch”. RSwitch is a tiny Mac program which allows you to switch between installed R versions.

But unfornately RSwitch told me that R version 4.0.5 was incomplete after I’ve installed version 4.1.0.

Accessing PIWIK PRO from R

The main tool for tracking the action on a website is Google Analytics. But more and more websites switch to other tools such as Matomo or PIWIK PRO due to GDPR.

My employer decided to switch to PIWIK PRO, too. So I was looking for a way to access the data PIWIK PRO was collecting to process it with R. When we used Google Analytics as web analytics tool I used RGoogleAnalytics. I added some enhancements such as caching the data and splitting the requests into daily chunks to handle sampling issues with Google Analytcs.

Unfortunately I haven’t found any R package providing access to PIWIK PRO data. So I wrote my own: piwikproR

Sorting German Numbers in DT datatable

DT::datatable() is a great way to show interactive tables in RMarkdown documents. (Unfortunately it’s a little bit tricky to use them with blogdown in combination with some hugo themes. But that’s another story.)

The user can sort any column as he wants to. But it’s an English tool. Numbers are formated in the American or English way: As decimal mark a point is used and between thousands a comma is used as separator. So it’s $ 1,234,567.89 $

In Germany both characters are switched: It’s $ 1.234.567,89 $.

You can format columns in DT::datatable() using the function formatRound() and its parameters interval, mark and dec.mark. But this breaks the sorting. Let’s have a look.

Splitting Linear Models

Last Thursday I watched Wolfgang Viechtbauer’s stream on Twitch. Wolfgang spoke about linear regression. (If you’re interested in the results: Wolfgang lists the R-code he wrote during the stream at https://www.wvbauer.com/doku.php/live_streams.)

During the stream we had an example with one categorical and one numeric predictor and we built a model with interaction between these two predictors. So the result is a straight line for each value of the categorival group.

The question was if it makes a difference if you build a simple linear model for each group.

So let’s look at it.