[R] override default arguments in nested function

Joshua Wiley jwiley.psych at gmail.com
Thu Apr 21 18:26:30 CEST 2011


On Thu, Apr 21, 2011 at 5:38 AM, Peter Ehlers <ehlers at ucalgary.ca> wrote:
> On 2011-04-20 19:45, Joshua Wiley wrote:
>>
>> Hi All,
>>
>> I think I already know the answer, but I am hoping I am missing
>> something.  I am using function omega from the psych_1.0-96 in R
>> version 2.13.0.  I would like to override one of the default arguments
>> of a function that is eventually called (to fix convergence issues),
>> the problem is there is no argument at the omega() function level that
>> make it to the function I want to override.  That is,
>>
>> omega calls schmid calls oblimin calls GPFoblq
>>
>> and I want to change an argument in GPFoblq.  Right now I am using
>> (the rather unsatisfactory):
>>
>> trace(what = GPFoblq, tracer = expression(maxit<- 2000), at = 10,
>> print = FALSE)
>>
>> to override the maximum number of iterations, which works but is a
>> hassle.  Anyone have other ideas/techniques?
>>
>> Thanks,
>>
>> Josh
>>
>>
> Does
>
>  formals(GPFoblq)$maxit <- 2000
>  omega(....)
>
> do what you want?

Yes!  AND it works in batch mode :) You're brilliant, thanks!

Josh

>
> Peter Ehlers



More information about the R-help mailing list