Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: Appending error messages to log file while running multiple script components in R

Roelof Coertze:

I am attempting to write Error Messages for my script to a log file. It works when I do:


test sink(test, type = "message")
try(data header = TRUE,
as.is = TRUE))
sink(type = "message", append = TRUE)
close(test)

However, when I add an additional component to the script, it does not append both error messages. In this case both input files do not exist and should give a "no such file directory" for each file. Here is my attempt for both input files:


enter code heretest
sink(test, type = "message")

try(data header = TRUE,
as.is = TRUE))

sink(type = "message", append = TRUE)
close(test)

test2 sink(test2, type = "message")

try(variables header = TRUE,
as.is = TRUE,
check.names = FALSE,
text = TRUE,
na.strings = c("", NA)))

sink(type = "message", append = TRUE)
close(test2)

Thank you!

P.s. would it be possible to customize my own error messages for each try()?



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: Appending error messages to log file while running multiple script components in R

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×