fix_region | R Documentation |
Correct any misspelt names of administrative regions i.e. States and LGAs
fix_region(x, ...)
## S3 method for class 'states'
fix_region(x, ...)
## S3 method for class 'lgas'
fix_region(x, interactive = FALSE, quietly = FALSE, graphic = FALSE, ...)
## Default S3 method:
fix_region(x, ...)
x |
An S3 object of class |
... |
Arguments passed to methods. |
interactive |
Logical. When |
quietly |
Logical; default argument is |
graphic |
Whether to make use of native GUI elements (on Windows only). |
The function will look through a character vector and try to
determine if State or LGA names have been wrongly entered. This presupposes that
the atomic vector is of type character
. It does not test any missing
values in the vector, leaving them untouched.
The transformed object. If all names are correct, the object is returned unchanged.
When passed a character vector of length 1L
, in the case of a
misspelt LGA, the function signals an error; the presumption is that a fix
can readily be applied interactively. When all the items provided are
misspelt, nothing happens, but the user is advised to use the appropriate
constructor function so as to improve the accuracy of the repairs. When
there is a mix of misspelt and properly spelt LGAs, other functionalities
for fixing the mistakes are available via mode interactive
.
try(fix_region("Owerri north")) # ERROR
fix_region(c("Owerri north", "Owerri West"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.