Re: [R] capturing errors in Sweave

2010-03-02 Thread Sundar Dorai-Raj
What I ended up using was: cat(unclass(tmp)) --sundar On Tue, Mar 2, 2010 at 8:58 AM, Berwin A Turlach wrote: > G'day Sundar, > > On Tue, 2 Mar 2010 01:03:54 -0800 > Sundar Dorai-Raj wrote: > > > Thanks, Berwin. That works just great! > > You are welcome. > > I noticed by now that "cat(tmp)" i

Re: [R] capturing errors in Sweave

2010-03-02 Thread Berwin A Turlach
G'day Sundar, On Tue, 2 Mar 2010 01:03:54 -0800 Sundar Dorai-Raj wrote: > Thanks, Berwin. That works just great! You are welcome. I noticed by now that "cat(tmp)" is sufficient; the "tmp[1]" in "cat(tmp[1])" was a left over from earlier attempts to get the output to look correct. Cheers,

Re: [R] capturing errors in Sweave

2010-03-02 Thread Berwin A Turlach
G'day Sundar, On Mon, 1 Mar 2010 23:46:55 -0800 Sundar Dorai-Raj wrote: > Thanks for the input, but I don't want "try" in the Sweave output. I > want the output to look just like it does in the console, as if an > uncaptured error really did occur. I don't think that you will get around using "

Re: [R] capturing errors in Sweave

2010-03-02 Thread Sundar Dorai-Raj
Thanks, Berwin. That works just great! --sundar On Tue, Mar 2, 2010 at 12:57 AM, Berwin A Turlach wrote: > G'day Sundar, > > On Mon, 1 Mar 2010 23:46:55 -0800 > Sundar Dorai-Raj wrote: > > > Thanks for the input, but I don't want "try" in the Sweave output. I > > want the output to look just li

Re: [R] capturing errors in Sweave

2010-03-01 Thread Sundar Dorai-Raj
Thanks for the input, but I don't want "try" in the Sweave output. I want the output to look just like it does in the console, as if an uncaptured error really did occur. --sundar On Mon, Mar 1, 2010 at 11:42 PM, Sharpie wrote: > > > Sundar Dorai-Raj-2 wrote: > > > > Hi, > > > > I'm writing a m

Re: [R] capturing errors in Sweave

2010-03-01 Thread Sharpie
Sundar Dorai-Raj-2 wrote: > > Hi, > > I'm writing a manual using Sweave and I want to be able to print errors > from > bad code. Here's an example: > > >= > MySqrt <- function(x) { > if (missing(x)) { > stop("'x' is missing with no default") > } > if (!is.numeric(x)) { > stop("'x

[R] capturing errors in Sweave

2010-03-01 Thread Sundar Dorai-Raj
Hi, I'm writing a manual using Sweave and I want to be able to print errors from bad code. Here's an example: >= MySqrt <- function(x) { if (missing(x)) { stop("'x' is missing with no default") } if (!is.numeric(x)) { stop("'x' should only be numeric") } if (x < 0) { stop("'