# An sf object containing point data
x_sf <- sf::st_as_sf(data.frame(x = c(0, 490000), y = c(400000, 0)),
crs = 29903,
coords = c("x", "y")
)
# Convert to Irish grid references
st_irishgridrefs(x_sf)
# Convert into Irish grid references with 4 digit easting and northing (10 m precision)
st_irishgridrefs(x_sf, digits = 4)
# Convert into Irish grid references with 1 km precision (2 digit easting and northing)
st_irishgridrefs(x_sf, precision = 1000)
# Convert into Irish grid references with 2 km precision (tetrad form)
st_irishgridrefs(x_sf, precision = 2000)
# Insert a space between the 100 km grid letter, easting, and northing
st_irishgridrefs(x_sf, sep = " ")
Run the code above in your browser using DataLab