Skip to contents

Checks the validity of a text string against the formal R Package naming requirements specified in the Writing R Extensions Manual.

Usage

check_package_name(txt)

Arguments

txt

String - Proposed package name to check the validity of.

Value

Boolean - TRUE/FALSE

Details

"The mandatory 'Package' field gives the name of the package. This should contain only (ASCII) letters, numbers and dot, have at least two characters and start with a letter and not end in a dot." - Writing R Extensions Manual

Examples

# Bad Packages
check_package_name("1pkg")
#> [1] FALSE
check_package_name("my_awesome_package")
#> [1] FALSE
check_package_name("a")
#> [1] FALSE

# Good packages
check_package_name("myawesomepkg")
#> [1] TRUE
check_package_name("my.awesome.pkg")
#> [1] TRUE
check_package_name("map")
#> [1] TRUE