Home R function Sink isn't redirecting messages or warnings to a file
Reply: 0

R function Sink isn't redirecting messages or warnings to a file

user651
1#
user651 Published in June 25, 2018, 7:56 am

I am looking to redirect stderr and stdout messages to an output file. Here's what I tried:

sink("outputFile" ,type = c("output", "message"))
print("using print")
cat("using cat\n")
message("using message")
warning("using warning")

When I run this code, I still see "using message" and "using warning" in my R console, and it's not being redirected.

Is there a way to redirect both stdout and stderr to a file? I used this code to redirect my stderr to stdout, but that's not exactly what I'm looking for.

sink(stdout(), type = "message") # sink messages to stdout
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.594931 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO