Learn R Programming

oce (version 0.8-10)

formatPosition: Format geographical positions to degrees, minutes, and hemispheres

Description

Format geographical positions to degrees, minutes, and hemispheres

Usage

formatPosition(latlon, isLat=TRUE, type=c("list", "string", "expression"))

Arguments

latlon
a vector of latitudes or longitudes
isLat
a boolean that indicates whether the quantity is latitude or longitude
type
a string indicating the type of return value (see below)

Value

  • A list containing degrees, minutes, seconds, and hemispheres, or a vector of strings or (broken) a vector of expressions.

Details

This function is in an early stage of development.

Examples

Run this code
library(oce)
formatPosition(10+1:10/60+2.8/3600)
formatPosition(10+1:10/60+2.8/3600, type="string")
# more realistic example (preview of possible style for axes)
data(coastlineHalifax)
plot(coastlineHalifax)
lon <- pretty(coastlineHalifax[["longitude"]], n=3)
lonlab <- formatPosition(lon, type="expression")
mtext(side=1, at=lon, text=lonlab, line=-1, col='red')
rug(lon, side=1, ticksize=0.03, col='red', lwd=3)

Run the code above in your browser using DataLab