Learn R Programming

gmt (version 1.2-0)

deg2num: Convert Degrees to Numeric

Description

Convert deg:min:sec string to decimal number.

Usage

deg2num(x)

Arguments

x
string or vector of strings.

Value

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.

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

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

Run the code above in your browser using DataLab