iskandarblue
iskandarblue

Reputation: 7526

Remove environment message in R markdown

In my r markdown file, I am outputting to html. In the code, I include"

{r, fig.align= "center", message= FALSE, warning= FALSE}

This removes all warnings and messages except this one:

   ## <environment: R_GlobalEnv>

Somewhere in the code I convert a list to objects in the environment with:

list2env(a1, envir = .GlobalEnv)

So I understand where the message is coming from but do not understand why it is not being removed by message = FALSE, warning = FALSE

Any suggetions?

Upvotes: 3

Views: 1023

Answers (1)

Rich Scriven
Rich Scriven

Reputation: 99331

That's not a message, it's the output of list2env().

Note: Don't run the following line if you don't want new objects in your global environment.

list2env(mtcars, .GlobalEnv)
# <environment: R_GlobalEnv>

You can suppress the output of a function by wrapping it with invisible().

invisible(list2env(a1, envir = .GlobalEnv))

Upvotes: 8

Related Questions