Just to also confirm that 

the strapply seems to be the faster.

I also wrote a mistake with the formula before, as have already be suggested,
the corrected is the

c(1, 1/60) %*% strapply(x, "\\d+.?\\d+", as.numeric, simplify = TRUE)


The only now is that I need to convert my data to a format that strapply will like to see.

The gpd coords are inside column of a csv file. After issuing read.csv I get.


str(a)
'data.frame':   352 obs. of  5 variables:
 $ N50..47.513.E006..03.985: Factor w/ 350 levels "N50° 47.514 E006° 03.985",..: 1 2 3 4 5 6 7 8 9 10 ...
 $ X                       : logi  NA NA NA NA NA NA ...
 $ X.1                     : logi  NA NA NA NA NA NA ...
 $ X.2                     : logi  NA NA NA NA NA NA ...
 $ Tuesday.06.03.2012      : Factor w/ 2 levels "","Wednesday 07.03.2012": 1 1 1 1 1 1 1 1 1 1 ...
> a
    N50..47.513.E006..03.985  X X.1 X.2   Tuesday.06.03.2012

and If I convert those to a matrix I get

> str(k)
 chr [1:352, 1:5] "N50° 47.514 E006° 03.985" "N50° 47.515 E006° 03.985" ...
 - attr(*, "dimnames")=List of 2
  ..$ : NULL
  ..$ : chr [1:5] "N50..47.513.E006..03.985" "X" "X.1" "X.2" ...
> k
       N50..47.513.E006..03.985   X  X.1 X.2 Tuesday.06.03.2012    
  [1,] "N50° 47.514 E006° 03.985" NA NA  NA  ""                    
  [2,] "N50° 47.515 E006° 03.985" NA NA  NA  ""                    
  [3,] "N50° 47.516 E006° 03.985" NA NA  NA  ""                    
  [4,] "N50° 47.517 E006° 03.985" NA NA  NA  ""                    
  [5,] "N50° 47.518 E006° 03.984" NA NA  NA  ""       



but I guess i need to convert only the first column where the gps coords are into a list.

How I can do that. This type cast in R is always a bit confusing

I would like to thank you in advance for your help

B.R
Alex



________________________________
 From: Gabor Grothendieck <ggrothendieck@gmail.com>
To: Daniel Nordlund <djnordlund@frontier.com> 
Cc: R help <R-help@r-project.org> 
Sent: Wednesday, March 7, 2012 8:41 PM
Subject: Re: [R] GPS handling libraries or (String manipulation)

On Wed, Mar 7, 2012 at 2:29 PM, Daniel Nordlund <djnordlund@frontier.com> wrote:
>> -----Original Message-----
>> From: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
>> On Behalf Of Gabor Grothendieck
>> Sent: Wednesday, March 07, 2012 8:52 AM
>> To: Alaios
>> Cc: R help
>> Subject: Re: [R] GPS handling libraries or (String manipulation)
>>

>> > 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)
>>
>>
>
> Isn't 47.513 in the string above just over 47 and one-half minutes?  In the calculation above, the .513 minutes is being treated as 513 seconds (I know that is what the OP asked for).  Shouldn't the calculation actually be something like this
>
>

>

If that's it then the regular expression could also be written as:  "[0-9.]+"


-- 
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.
	[[alternative HTML version deleted]]

