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.

Converting Lists of Lists of Lists to Data.Frames (or Tibbles)

I’m working on an R-package to access the data of a web service. So I have to handle large data I get back from an API call. The result is encoded in JSON-format which itself results in a large list of lists (of lists).

But I want to convert these lists of lists into a data.frame or tibble. Sounds easy …. Here are the caveats I came across.