# Degree Decimal Minutes (DDM) to Degree Minutes Seconds (DMS)
ddm2dms = 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, "°"))
signal = sign(crd[1])
crd = abs(crd)
degree = crd[1]
minutes = crd[2] - (crd[2] %% 1)
seconds = (crd[2] %% 1) * 60
if(num) out = c("deg" = signal * degree, "min" = minutes, "sec" = round(seconds, 3))
else out = paste0(signal * degree, "\uB0 ", minutes, "\u27 ", round(seconds, 3), "\u22")
return(out)
}, num = num #end function
)#end sapply
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 ddm2dms
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.