Hi I have a package named asm which contains many non-exported functions which are all starting with "for.eq.".
I also have an S4 class ASM which, when a new object asm of class ASM is created by using the function newASM() (in the package asm) contains among other slots one sot with an environment called "equations" (including the definition of the function"equations" and "equations<-"). Now in this function newASM() I want to copy all functions starting with "for.eq." into this environment. I have the following code: --8<---------------cut here---------------start------------->8--- ASM@equations <- new.env() funs <- apropos("^for\\.eq\\.", mode="function") for (fun in funs) { assign( gsub("for.eq.", "", fun), get(fun), ASM@equations ) } --8<---------------cut here---------------end--------------->8--- outside the package I call it as follow: --8<---------------cut here---------------start------------->8--- asm <- newASM() --8<---------------cut here---------------end--------------->8--- This worked fine when the functions "for.eq.*" were exported, but does not work anymore now that I don't export them anymore. This is a bit surprising to me, as the function newASM() is in the package and I assumed that inside of a package, all exported and non-exported functions are seen. My question: how can I add all functions starting with "for.eq." into the environment, irrespective if they are exported or not? Why I want to do this: I want to be able to have the functions encapsulated in the environment of the object asm as they are used in a simulation executed by the sim() function, which attaches the equations environment at the beginning and detaches it at the end. This enables me to have different simulation objects with different functions. Thanks, Rainer -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug PGP: 0x0F52F982
signature.asc
Description: PGP signature
______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel