deg2num: Convert Degrees to Numeric

View source: R/deg2num.R

deg2numR Documentation

Convert Degrees to Numeric

Description

Convert deg:min:sec string to decimal number.

Usage

deg2num(x)

Arguments

x

string or vector of strings.

Details

Degrees, minutes and seconds are separated by colons, and each can have a decimal point as well. First character must be a minus sign or number, and last character must be W, E, S, N, or number.

Value

Numeric representation of the degree string(s).

Note

The string format is adopted from Appendix B.1.1 in the GMT manual.

See Also

as.numeric converts strings to numbers when things are straightforward.

deg2num is the opposite of num2deg.

gmt-package gives an overview of the package.

Examples

# The opposite of num2deg() example
deg2num(c("12:30:44.5W", "17.5S", "1:00:05", "200:45E"))

arnima-github/gmt documentation built on April 21, 2023, 7:12 p.m.