1

Based on this question and related, I am using measurements::conv_unit() to convert Degree:Min:Sec coordinates to decimal.
However, whilst of correct 'value', my return is a character vector, not numeric as should be according to all I've seen elsewhere. My input is character as per per ?measurements::conv_unit : "Coordinate: Values must be entered as a string with one space between subunits (e.g. 70° 33’ 11” = "70 33 11")."

Example:

df <- c("1 1 1", "-1 1 1", "2 2 2","-2 2 2")  

measurements::conv_unit(df, from = 'deg_min_sec', to = 'dec_deg')
[1] "1.01694444444444"  "-1.01694444444444" "2.03388888888889"  "-2.03388888888889"

The conversion to numeric (via as.numeric()) is of course a simple solution, but this shouldn't be needed in the first place I believe. The result is same whether I define df as c(), data.frame() or tibble(), and even when above is run in a clean (restarted) R session. Measurements version 1.1.0, installed just today.

Am I doing something wrong or what's happening?

Robbes
  • 135
  • 8

1 Answers1

0

This is intended as per the source code of conv_unit:

if (to == "dec_deg") inter = as.character(lapply(secs, function(y) y/3600)) 
LyzandeR
  • 37,047
  • 12
  • 77
  • 87