I am using the library sp as suggested here and here to convert from degree-minute-second (dms) representation to decimal degrees(dd).
If I try the following code using sp, this is the result:
loc$Lat<-sp::char2dms(loc$Lat)
Error in rep(value, length.out = nrows) : attempt to replicate an object of type 'S4'
A sample of my data is as follows:
c("39d47m01s N", "15d38m08s N", "12d45m01s N", "13d17m25s N",
"36d34m29s N", "24d46m34s S", "11d52m39s S", "39d47m01s N", "30d52m34s N",
"34d59m47s S")
I need to convert from dms to dd as I want to calculate Haversine (great circle distances) between points.
I am also open to using other packages to do the conversion.
I tried using the library birk but it is giving me some meaningless answers where the lat/long are greater than 1000. Before, trying birk, I had converted the lat/long representation to one that birk accepts in its conv_unit
function