BroVic
BroVic

Reputation: 1079

R: Suppressing renv project startup message

Typically, when starting up an renv project, one gets a message that looks something like this:

* Project '~/path/to/project' loaded. [renv 0.10.0]

I am trying to suppress this message, particularly when non-interactively running a script from this project.

Checking the package help, I noted ?config i.e. User-Level Configuration of renv. Specifically, I found synchronized.check, of which the document states is for controlling how renv lockfile synchronization is checked (this is also outputted to the console). However, I couldn't find how to control the main startup message. I also checked the ?settings but found nothing relevant either.

I've tried fiddling with options and Sys.setenv without luck so far.

So, is it possible to suppress the message, seeing that the renv script activate.R controls how the package itself is loaded?

Upvotes: 1

Views: 285

Answers (2)

Kevin Ushey
Kevin Ushey

Reputation: 21315

You are correct that there isn't a specific documented way to configure this in renv. For now, you can set:

options(renv.verbose = FALSE)

before renv is loaded. (You may want to turn it back to TRUE if you want renv to display other messages as part of its normal work.)

Upvotes: 4

cdalitz
cdalitz

Reputation: 1277

You can suppress library startup messages with suppressPackageStartupMessages, e.g.

suppressPackageStartupMessages(library(igraph))

There is also suppressMessages for arbitrary function calls.

Upvotes: 0

Related Questions