[R] GPS handling libraries or (String manipulation)
ggrothendieck at gmail.com
Wed Mar 7 17:51:46 CET 2012
On Wed, Mar 7, 2012 at 11:28 AM, Alaios <alaios at yahoo.com> wrote:
> Dear all,
> I would like to ask you if R has a library that can work with different GPS formats
> For example
> I have a string of this format
> N50° 47.513 E006° 03.985
> and I would like to convert to GPS decimal format.
> that means for example converting the part N50° 47.513
> to 50 + 47/60 + 513/3600.
> Is it possible to do that with R?
> What is the name of such a library?
Use strapply to extract the digits and convert them to numeric
followed by matrix multiplication to apply the formula:
x <- "N50° 47.513"
c(1, 1/60, 1/3600) %*% strapply(x, "\\d+", as.numeric, simplify = TRUE)
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
email: ggrothendieck at gmail.com
More information about the R-help