Search code examples
rpackage

Determine name of R package my code is in?


I'm working on an R package and (in the package's code) need to determine the version number when a certain function is called.

packageVersion("mypackage") works, but I'd rather not hard code the name of the package. How can I ask "what's the name of the package I'm in"? (Or directly get the version number of the package I'm in.)


Solution

  • This mailing list thread describes packageName().

    (As Martin pointed out in comments.)