[R] Defining/Checking constants in packages

Giovanni Petris GPetris at uark.edu
Wed Nov 20 22:39:35 CET 2002


In a package I am writing I need to use the constant pi (3.14..., that
is) which is already defined in R. However, how can I make sure the
user has not changed its value before loading the package? 
If this happened, is a reference to `pi' in the package going to use
the user-defined value or the value defined in base?
I thought I could solve the issue by including the following line in
my package
   pi <- get("pi", pos=grep("package:base",search()))
but then when I load the package R warns me about masking issues. 
What is the recommended way of dealing with this issue?

Thank you in advance,
Giovanni

-- 

 __________________________________________________
[                                                  ]
[ Giovanni Petris                 GPetris at uark.edu ]
[ Department of Mathematical Sciences              ]
[ University of Arkansas - Fayetteville, AR 72701  ]
[ Ph: (479) 575-6324, 575-8630 (fax)               ]
[ http://definetti.uark.edu/~gpetris/              ]
[__________________________________________________]

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list