Parse an NYPD law_code string into its structural fields
Source: R/datasets_nyc_nypd.R
morie_parse_nypd_law_code.RdPhase 3CCC1. NYPD law codes are space-or-zero-padded composites of a 1-4 char statute book prefix and a numeric/alpha section identifier. Examples:
Details
"PL 1601005"-> book=PL, section=1601005 (Penal Law)"VTL0511000"-> book=VTL, section=0511000"AC 0019190"-> book=AC, section=0019190 (NYC Admin Code)"ABC0064A00"-> book=ABC, section=0064A00
The book prefix is extracted as the leading run of uppercase ASCII letters; the section is everything after the prefix with leading whitespace stripped. NA / empty inputs return NA fields.
Examples
morie_parse_nypd_law_code(c("PL 1601005", "AC 0019190", "ABC0064A00"))
#> book section
#> 1 PL 1601005
#> 2 AC 0019190
#> 3 ABC 0064A00