R sink(): Error, cannot split the message connection
问题 I am trying to log the errors and warnings of an R script into an external file. At the same time I want to be able to see the errors and warnings in the console in RStudio (useful to develop and debug). I am trying to use the following code: logfile <- file("my_file_path", open="wt") sink(logfile, type="message", split = TRUE) But when I try to split the message connection using the funciton sink() I get the following error: Error in sink(logfile, type = "message", split = TRUE) : cannot