valid_pkgname: Validate package and function names

Description Usage Arguments Value References See Also Examples

View source: R/extension-utils.R

Description

Naming rule obtained from 'Writing R Extensions' manual. The corresponding regular expression used for verifying the package name is "[[:alpha:]][[:alnum:]\.]*[[:alnum:]]". For function names this is "((?:[[:alpha:]]|\.(?![0-9]))[[:alnum:]_\.]*)"

Usage

1
2
3

Arguments

pkg

string vector containing package names. Can be a vector of strings with size of at least 1.

func

string vector containing function names. Can be a vector of strings with size of at least 1.

Value

A named logical indicating whether the package name is valid.

References

make.names, 'Writing R Extensions' manual.

See Also

Other developer functions: crossref_description, generic_implementations, load_packages, update_settings

Examples

1
2
3
4
5
6
7
valid_pkgname("hgutils") # valid
valid_pkgname("ggplot2") # valid
valid_pkgname("pkg2.-1") # invalid

valid_funcname(".hgutils") # valid
valid_funcname("ggplot2") # valid
valid_funcname(".2pkg") # invalid

hgutils documentation built on Sept. 7, 2019, 5:10 p.m.