Re: [R] Print warning messages and save them automatically in a file

2012-04-20 Thread Greg Snow
Would using the 'sink' function with type='message' and split=TRUE do what you want? On Thu, Apr 19, 2012 at 2:00 AM, Alexander wrote: > Hello, > I am working under R2.11.0 Windows and I would like to ask you if you know a > way to save all warning messages obtained by the R function "warning" in

Re: [R] Print warning messages and save them automatically in a file

2012-04-19 Thread Alexander
My temporary solution to the problem is "trace": trace(warning,tracer=quote({ tmp<-try(cat(paste(...),"warning.log",append=TRUE,fill=TRUE)) if(is(tmp,"try-error")){ print(sys.call()) print(unlist(...)) } })) with best regards Alexander wro

[R] Print warning messages and save them automatically in a file

2012-04-19 Thread Alexander
Hello, I am working under R2.11.0 Windows and I would like to ask you if you know a way to save all warning messages obtained by the R function "warning" in a file and keeping the functionalities of the base-function warning. For example if I use external code, I don't want to replace all lines con