1

I'm setting up tests for my personal R package and I want to minimise the output to the Build console (I'm on RStudio). I'm using sink to suppress messages from my own functions (see discussion here) because they're only relevant in an interactive data analysis context. This is not ideal but it works; any hints as to how to handle that better would be appreciated.

What I haven't managed to eliminate are package attachment messages. My package attaches tidyverse and sf, which added to testthat, means I get a long list of well-known mask warnings and version information. Having suppressMessages(library(my_package)) (see the highest voted answer here) on testthat.R doesn't seem to do the trick either.

Any help would be most appreciated.

Fons MA
  • 1,142
  • 1
  • 12
  • 21
  • What about the `suppressPackageStartupMessages()` function? When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) that can be used to test and verify possible solutions. – MrFlick Apr 01 '20 at 03:46
  • Thank you so much, Mr Flick. `supressMessages` is meant to cover `suppressPackageStartupMessages`. I've added a link to a relevant answer and checked that, indeed, it makes no difference. Sorry, I'm not sure how I can provide a reproducible example of testing a working R package? the mock code as I've written it above works on any standard R script... it doesn't in the `testthat` environment, hence the question. Please do let me know what I can share that would be useful. – Fons MA Apr 01 '20 at 08:20

0 Answers0