Skip to content

[R-pkg-devel] Export everything whose name does not start with ".".

3 messages · Hugh Parsonage, Rolf Turner

#
There was fairly recently a discussion on this list of a problem whose
solution involved having code in NAMESPACE which exported everything
whose name did not start with ".".

In the course of this discussion it was remarked that the code given in
"Writing R Extensions", explicitly

   exportPattern("^[^\\.]")

wasn't quite right and could/should have a simpler form.

I don't really understand what's going on --- regular expressions
completely blow me away.

Can someone please inform me as to what the simpler form should be?

[What really frustrates me is that I was *sure* I had saved the emails
pertaining to this discussion, but now I cannot find any <expletive
deleted> trace of what I thought I'd saved!]

cheers,

Rolf Turner
#
It would have been helpful for that person to specify their candidate
regex, rather than just saying it could be simpler.

That out of the way, I believe

   exportPattern("^[^.]")

would be sufficient since the square brackets remove any special
meaning the dot has. For an alternative, given the limitations on
syntactic identifiers in R (namely, that they must start with either a
dot or letters), one might also consider

   exportPattern("^[A-Za-z]")
On Sat, 16 Mar 2024 at 11:03, Rolf Turner <rolfturner at posteo.net> wrote:
#
On Sat, 16 Mar 2024 11:39:28 +1100
Hugh Parsonage <hugh.parsonage at gmail.com> wrote:

            
Actually they *did* specify; the problem was that my ageing senile
memory could not recall the specification.

<SNIP>

cheers,

Rolf