This function returns the 1km grid reference for a higher precision grid reference.

monad(x)

# S3 method for gridref
monad(grid_reference)

Arguments

grid_reference

A Great British or Irish grid reference character string with class gridref.

Value

The grid reference at 2km resolution.

Details

It can check either British or Irish grid references up to 10 figure (1m precision), including tetrads (2000m precision).

REST API

A REST API endpoint is available once a Plumber router has been created and can be requested by adding _api to the end of the function.

The API returns "" instead of NULL so that it may be used with the dplyr::mutate function. Wrap the API call with dplyr::na_if to convert "" to NA.

suppressPackageStartupMessages({
  library(store)
  suppressWarnings({
    library(plumber)
  })
})
pr("../R/gridref_api.R") %>%
  pr_run(port = 8000)

See also

Other grid reference functions: easting(), gridsquare_geometry(), hectad(), hectare(), northing(), pentad(), precision(), projection(), tetrad()

Examples

suppressPackageStartupMessages({ library(store) suppressWarnings({ library(dplyr) library(janitor) }) }) grid_references <- nbn_demonstration_dataset %>% clean_names() %>% slice_tail(n = 15) %>% select(grid_reference) %>% mutate(grid_reference = as_gridref(grid_reference)) # add one_km column suppressPackageStartupMessages({ suppressWarnings({ library(dplyr) }) }) grid_references %>% rowwise() %>% mutate(one_km = monad(grid_reference))
#> # A tibble: 15 x 2 #> # Rowwise: #> grid_reference one_km #> <gridref> <chr> #> 1 TL2384 TL2384 #> 2 TL232839 TL2383 #> 3 TL2385 TL2385 #> 4 TL231840 TL2384 #> 5 TL232839 TL2383 #> 6 TL23248346 TL2383 #> 7 TL23568493 TL2384 #> 8 TL23448505 TL2385 #> 9 TL23128324 TL2383 #> 10 TL234850 TL2385 #> 11 TL234846 TL2384 #> 12 TL232839 TL2383 #> 13 TL231841 TL2384 #> 14 TL226846 TL2284 #> 15 TL2384 TL2384