R CMD check regex note

Hi! I am working on a package in which a function I am creating uses regex() from base R. When I submit devtools::check() I see a note that

no visible global function definition for 'regex'

and

Undefined global functions or variables:
regex

Do I need to declare regex() as an import somehow? How do I resolve this?

Thank you for any assistance!

There is no regex() function in base. There is one, however in stringr, maybe that's the one you are using?

❯ base::regex
Error: object 'regex' not found

❯ getAnywhere("regex")
no object named ‘regex’ was found

❯ stringr::regex
function (pattern, ignore_case = FALSE, multiline = FALSE, comments = FALSE,
    dotall = FALSE, ...)
1 Like

Thank you for the response, Gabor! This is confusing me.

When I execute

help.search("regex")

I see this

and the page looks like this:

Here is a link containing the same information:

https://rdrr.io/r/base/regex.html

but I also agree with your base::regex() not found.

Any further insights would be appreciated!

Manual pages do not always correspond to single functions. Sometimes they do not correspond to functions at all, but they just document a topic. There is a manual page called regex but no function with that name, at least not in base R.

1 Like

Oh, wow! 🤦 I completely missed that, thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.