Convert longitude/latitude formats from DMS to D.dec or DM.dec
Test of different packages to convert lo ng/lat data Package sp Several packages can do the job. First, let use sp package. The orignal data can be in character string or in numbers. > library("sp") > essai <- char2dms(from="01d33'01.6\"N", chd="d", chm="'") > as.numeric(essai) [1] 1.550444 > essai <- char2dms(from="01°33'01.6\"N", chd="°", chm="'") Take care, the " character cannot be omitted: > essai <- char2dms(from="01°33'01.6N", chd="°", chm="'") > essai [1] 1d33'N > as.numeric(essai) [1] 1.55 Numeric data can be used directly using: > essai <- new(Class = "DMS", WS=FALSE, deg=1, min=33, sec=1.6, NS=TRUE) > essai [1] 1d33'1.6"N > as.numeric(essai) [1] 1.550444 And such DMS class object can be obtained from D.dec format using: ...