olctools (version 0.3.0)

validate_olc: Check the Validity of Open Location Codes

Description

These functions allow a useR to check whether OLCs they've been provided are valid or not. valid_short identifies whether a vector of OLCs are valid "short" codes; valid_long identifies whether OLCs are valid "long" codes, and valid_full identifies whether OLCs are valid, full stop.

Usage

validate_olc(codes)
validate_short(codes)
validate_full(codes)

Arguments

codes
a character vector containing Open Location Codes.

Value

a vector of TRUE and FALSE values, where TRUE corresponds to a valid code and FALSE an invalid.

See Also

decode_olc and encode_olc for creating and resolving valid Open Location Codes.

Examples

Run this code
#Validate that a particular OLC is valid
validate_olc("WC2345+G6g")
#[1] TRUE

#It is! Is it a short?
validate_short("WC2345+G6g")
#[1] TRUE
#Yep!

#So it's not full?
validate_full("WC2345+G6g")
#[1] FALSE
#Nope!

Run the code above in your browser using DataLab