Permitted R libraries

What R libraries are (are not) permitted for R track exercises? Is there somewhere I can look this up?

I passed all tests locally for word-count. I used library “readr”, submitted via CLI but discover I have failed with message:

Error in library(readr) : there is no package called ‘readr’
Calls: source -> withVisible -> eval -> eval -> library
Execution halted

Looking at the docker file for the test-runner, it looks like only the testthat package is installed.

Unfortunately yes - for now we only have base R packages (and testthat) available in the test runner.

Ideally we’d like to have all tidyverse packages available in the test runner, but this has thus far proven much less straightforward to achieve than one would expect.

A while back I tried a number of dockerfile variants (using different base images and/or approaches to install R packages) that work for me locally but don’t seem to work when run on Exercism’s test runner infrastructure.

See this issue and related PR’s for more info: OpenBLAS issue with alternative docker image · Issue #59 · exercism/r-test-runner · GitHub

I need to try and pick this up again with @ErikSchierboom to see if we can come up with a setup that works.

@jonmcalder It’s worth giving it another try, as we’ve since updated the Docker engine (we were on quite an old version before).

Thanks. That answers my question.

Although, it puzzles me that I see some community solutions using the pipe (%>%) operator, which only works for me locally if I load the dplyr library.

There will be many community solutions that pre-date the test runner (i.e. from v1 of Exercism) and/or were developed & tested locally and then pushed via the CLI rather than done in the web interface, so these solutions could in theory make use of any R package one has installed locally.

My apologies again since this topic has come up before on a few occasions and hasn’t been adequately addressed. I’m aware that it may seem like the track is built only with base R in mind, but that wasn’t really intentional - it’s only because the test runner in the web interface was kept lightweight to begin with and hasn’t (yet) been updated to include the tidyverse.

It is not our intention to limit solutions to base R and (subject to each individuals learning goals of course) I’d very much encourage use of the tidyverse either where it makes sense to do so, or simply for the purpose of trying different approaches to a problem (both with or without mentoring). I feel this is very much within the spirit of Exercism to learn by exploring and comparing different ways of solving problems both within and between different programming languages.

With that in mind I hope that we’ll be able to support tidyverse solutions via the test runner going forward.

1 Like

OK. No apology required.

@jonmcalder Feel free to re-create any of the earlier PRs that should have fixed this

1 Like

Just realised that I didn’t loop back to update this thread.

The R test runner was updated on Oct 3 and now supports packages from the tidyverse.

4 Likes