[Rd] Problem with accessing internal variable in package.

From: Vladimir Eremeev <wl2776_at_gmail.com>
Date: Fri, 25 May 2007 00:33:35 -0700 (PDT)

I am writing a package, which contains several functions and variables. The variables are for internal use by functions. Functions are ment to be callable by a user. However, the function cannot access these variables.

The package contains only R code, and was created using package.skeleton

package.skeleton(name="ac9",

                 list=c(ls(pattern="(AB2)|(ac9)"),
                        "Chl","Pro","LP","SP","syn","unk","Y","Nh",
                        "plot.C","read.AC9.data","EstimC","plot.AC9"),
                  namespace=TRUE,force=TRUE)

Among others, the package contains the functions EstimC, AB2C, AB2C.S, and AB2C.HK, and variables ac9nw, ac9wl, ac9aw, ... Functions use these variables for calculations, and I would like to hide them from users.

The file NAMESPACE contains the single line:   export(AB2C.HK,AB2C,AB2C.S,EstimC,plot.C,read.AC9.data,plot.AC9)

I am getting the following error:
Error in AB2C(a, b, model.type) : object "ac9nw" not found

> traceback()

2: AB2C(a, b, model.type)
1: EstimC(i, plot.base.name = paste(plt.base.name, "S_", sep = ""),

       model.type = "S")

> sessionInfo()

R version 2.5.0 Patched (2007-05-13 r41549) i386-pc-mingw32

locale:
LC_COLLATE=Russian_Russia.1251;LC_CTYPE=Russian_Russia.1251;LC_MONETARY=Russian_Russia.1251;LC_NUMERIC=C;LC_TIME=Russian_Russia.1251

attached base packages:

[1] "datasets"  "utils"     "stats"     "graphics"  "grDevices" "methods"  
[7] "base"     

other attached packages:
         ac9 xlsReadWrite       matlab         MASS 
       "0.1"      "1.3.2"      "0.8-1"     "7.2-33" 


-- 
View this message in context: http://www.nabble.com/Problem-with-accessing-internal-variable-in-package.-tf3814649.html#a10798364
Sent from the R devel mailing list archive at Nabble.com.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri 25 May 2007 - 07:38:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 May 2007 - 09:33:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.