On Wed, Mar 7, 2012 at 11:28 AM, Alaios <ala...@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: library(gsubfn) 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. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.