Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove environment message in R markdown

Tags:

r

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?

like image 563
iskandarblue Avatar asked Dec 18 '25 00:12

iskandarblue


1 Answers

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))
like image 127
Rich Scriven Avatar answered Dec 20 '25 16:12

Rich Scriven



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!