0

Similar to this question How to save all console output to file in R?

Though i want the output in two different logs.

con <- file("test.log")
sink(con, append=TRUE)
sink(con, append=TRUE, type="message")

print(1+1)

#clc <- function() cat("\f")
#clc()

con2 <- file("test2.log")
sink(con, append=TRUE)
sink(con, append=TRUE, type="message")

print(2+2)

If i do this, R saves both 2 and 4 into test.log. test2.log just gets ignored and is not created. How can i achieve to save them seperately? I also played around with clearing console but that didnt seem to work out either.

Kind regards!

Dutschke
  • 277
  • 2
  • 15

0 Answers0