conv_dm2dd | R Documentation |
This function is used to convert latitude and longitude from degrees, minutes format to decimal degree format, which is useful for map drawing.
conv_dm2dd(
dm60,
sep_marks = c(".", "-", "_", "u00b0"),
out_original = FALSE,
out_original_D = FALSE,
out_original_M = FALSE
)
dm60 |
sexagesimal numbers of character / numeric class. |
sep_marks |
a separation character between D and M part. Default: c(".", "-", "_", "u00b0") |
out_original |
include original values to output. Default: FALSE. |
out_original_D |
D (degrees) part on console to make sure the conversion is correct. Default: FALSE. |
out_original_M |
print M (minutes) part on console to make sure the conversion is correct. Default: FALSE. |
See example
a vector of numeric class (default) or a data.frame if any output options are TRUE.
if(interactive()){
numx <- c(34.30, 34.3, 34.03)
conv_dm2dd(numx) # 34.50 34.50 34.05
conv_dm2dd(numx, out_original_D = TRUE, out_original_M = TRUE)
x <- c("35.30", "35.3", "35.03", "35", "30.30", "30.30.750")
conv_dm2dd(x) # Make sure the last value equals (30 + 0.30750 / 60 * 100)
x2 <- c("35°30′", "30°30.750′", NA, "35-30", "30-30.750", NA, "30_03")
conv_dm2dd(x2)
conv_dm2dd(x2, out_original = TRUE, out_original_D = TRUE, out_original_M = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.