Re: [Rd] setting option in function

2012-10-19 Thread Charles Geyer
That was easy. Thanks. That will fix a problem a lot of users are having with the aster package. If users have NA's in their data, then they almost certainly don't know what they are doing (with aster). On Fri, Oct 19, 2012 at 5:10 PM, Thomas Lumley wrote: > old_options <- options(na.action=n

Re: [Rd] setting option in function

2012-10-19 Thread William Dunlap
.com > -Original Message- > From: r-devel-boun...@r-project.org [mailto:r-devel-boun...@r-project.org] On > Behalf > Of Charles Geyer > Sent: Friday, October 19, 2012 2:35 PM > To: r-devel@r-project.org > Subject: [Rd] setting option in function > > is it possi

Re: [Rd] setting option in function

2012-10-19 Thread Thomas Lumley
old_options <- options(na.action=na.fail) on.exit(options(old_options)) You can also use this to define a wrapper that executes an expression using special options withOptions<-function(optlist,expr){ oldopt<-options(optlist) on.exit(options(oldopt)) expr<-substitute(expr)

[Rd] setting option in function

2012-10-19 Thread Charles Geyer
is it possible to set an option inside a function ((I want to set na.action = na.fail) and have the previous state restored if there is an error so that the function doesn't change the option behind the user's back? Sorry if this has been answered before, but this subject is hard to Google. -- Ch