#' Degree Decimal (DD) to Degree Decimal Minutes (DDM)
#'
#' @param coord coordenada
#' @param num out numeric or character
#'
#' @examples
#' \dontrun{
#' x = c(-77.50834)
#' dec2ddm(x)
#' }
#' @export
dec2ddm = function(coord, num = TRUE)
{
out = sapply(coord,
function(coord, num)
{
## standardized in vector numerical
crd = coord_clean(coord)
#if(length(crd) > 1) if(num) return(crd) else return(coord)
if(crd %% 1 == 0) if(num) return(crd) else return(paste0(crd, "\uB0"))
signal = sign(crd[1])
crd = abs(crd)
degree = crd - crd %% 1
m1 = (crd %% 1) * 60
#minutes = m1 - (m1 %% 1)
#seconds = (m1 %% 1) * 60
if(num) out = c("deg" = signal * degree, "min" = m1)
else out = paste0(signal * degree, "\uB0 ", round(m1, 3), "\u27")
return(out)
}, num = num )
if(num)
{
out = t(out)
rn = 1:nrow(out)
out = as.data.frame(out, row.names = rn)
out$Coord = coord
}#end if
return(out)
}#end dec2ddm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.