Hi, I've seen that some packages use .packageName internally to infer their own name. Is that officially supported? I could not find it documented anywhere. There's utils::packageName(), which internally looks for .packageName. However, if the latter is not found, it may return NULL whereas an error would be more appropriate if a package name is expected. Using .packageName would give an error if it does not exist. Also, which is minor, using packageName() would add explicit dependency on the utils package whereas .packageName doesn't. So, should I use .packageName or utils::packageName() for this? Thanks Henrik
On 12/07/2016 2:55 PM, Henrik Bengtsson wrote:> Hi, I've seen that some packages use .packageName internally to infer > their own name. Is that officially supported? I could not find it > documented anywhere. > > There's utils::packageName(), which internally looks for .packageName. > However, if the latter is not found, it may return NULL whereas an > error would be more appropriate if a package name is expected. Using > .packageName would give an error if it does not exist. Also, which is > minor, using packageName() would add explicit dependency on the utils > package whereas .packageName doesn't. > > So, should I use .packageName or utils::packageName() for this?You should use utils::packageName. It is documented; .packageName is not. Duncan Murdoch
Seemingly Similar Threads
- R v2.10.0: Doc clarification for cross references and where are we heading?
- Best way to locate R executable from within R?
- SUGGESTION: Add get/setCores() to 'parallel' (and command line option --max-cores)
- Inferring dimensions on bitmap device from par()
- How to infer default width and height for a device?