>>> El día 15/07/2013 a las 13:30, Duncan Murdoch <murdoch.dun...@gmail.com> escribió: > On 13-07-15 5:27 AM, Helios de Rosario wrote: >> Hi, >> >> What should I do if I want to use "non-default" R-options for the >> functions inside a package, but not affect the options of the rest of >> the session? Specifically, I'm thinking of using "sum contrasts" instead >> of the default, in functions like "lm", etc. when they are called by >> other functions in a package.
[...] > I'd recommend that in your own functions that need this, you put this at > the beginning: > > saveOpts <- options(contrasts = c("contr.sum", "contr.sum")) > on.exit(options(saveOpts)) > > This means that the options will be changed just for the duration of the > call. If there are situations where users might not want this new > default, make the new value a default of a function argument. Thank you very much. I was not aware of the on.exit function. Helios De Rosario INSTITUTO DE BIOMECÁNICA DE VALENCIA Universidad Politécnica de Valencia • Edificio 9C Camino de Vera s/n • 46022 VALENCIA (ESPAÑA) Tel. +34 96 387 91 60 • Fax +34 96 387 91 69 www.ibv.org Antes de imprimir este e-mail piense bien si es necesario hacerlo. En cumplimiento de la Ley Orgánica 15/1999 reguladora de la Protección de Datos de Carácter Personal, le informamos de que el presente mensaje contiene información confidencial, siendo para uso exclusivo del destinatario arriba indicado. En caso de no ser usted el destinatario del mismo le informamos que su recepción no le autoriza a su divulgación o reproducción por cualquier medio, debiendo destruirlo de inmediato, rogándole lo notifique al remitente. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.