num2deg {gmt} | R Documentation |
Convert Numeric to Degrees
Description
Convert decimal number to deg:min:sec string.
Usage
num2deg(x, lat=NA, dec=FALSE, digits=0, zero=FALSE)
Arguments
x |
number or vector of numbers. |
lat |
whether |
dec |
whether to return decimal degrees instead of deg:min:sec. |
digits |
precision used when rounding decimal degrees or seconds. |
zero |
whether trailing |
Details
Element-specific format is supported, using vectors for lat
,
digits
, and precision
.
The resulting string ends with N or S when lat
is TRUE
,
E or W when lat
is FALSE
, or a number when lat
is
NA
.
Value
deg:min:sec string representation of the number(s).
Note
The string format is adopted from Appendix B.1.1 in the GMT manual.
See Also
as.character
converts plain numbers to strings.
num2deg
is the opposite of deg2num
.
gmt-package
gives an overview of the package.
Examples
# The opposite of deg2num() example
num2deg(c(-12.51236, -17.5, 1.00139, 200.75),
lat=c(FALSE, TRUE, NA, FALSE),
dec=c(FALSE, TRUE, FALSE, FALSE),
digits=c(1, 1, 0, 0))
[Package gmt version 2.0.3 Index]