0

Trying to use message for some simple logging in RStudio. I would love to have the possibility of messages ending up in a temp file.

After reading this How can you always suppress messages in R? I thought I knew how to proceed.

message("this is red text on screen")

zz <- file("messages.Rout", open = "wt")
sink(file=zz, type = "message")

message("This I hope only goes to the file")

sink(type="message") #Reset so that messages come out to screen as normal

Problem is that the text This I hope only goes to the file still shows up in the console within RStudio when Current Chunk is Run.

Am I misunderstanding something?

Big thanks in advance, I've been using R for a while but often come back with newbie questions....

maze
  • 335
  • 4
  • 9

0 Answers0