Learn R Programming

LightLogR (version 0.10.0)

format_coordinates: Format coordinates as a readable string

Description

Create a concise latitude/longitude label (e.g., \(48.5^\circ N, 9.1^\circ E\)) from a two element coordinate vector.

Usage

format_coordinates(coordinates, digits = 1)

Value

A character scalar with the formatted coordinate string.

Arguments

coordinates

A numeric vector of length two with latitude as the first element and longitude as the second element.

digits

Integerish scalar defining the number of decimal places used for rounding. Defaults to one decimal place.

Examples

Run this code
# Coordinates for Tuebingen, Germany
format_coordinates(c(48.5216, 9.0576))

Run the code above in your browser using DataLab