Re: [R] Gps fraction of degrees function

2011-12-21 Thread Clint Bowman
I see my pre-coffee fingering hit an incorrect key in the final line--"E" is positive, "W" is negative. -- Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 40

Re: [R] Gps fraction of degrees function

2011-12-21 Thread Clint Bowman
The following (untested) should get you close: deg<-as.integer(strsplit(coords, "?")[[1]][1]) min<-as.integer(strsplit(strsplit(coords, "?")[[1]][2], "'")[[1]][1]) sec<-as.numeric(strsplit(strsplit(strsplit(coords, "?")[[1]][2], "'")[[1]][2], "\"")[[1]][1]) nswe<-strsplit(strsplit(strsplit(coor

[R] Gps fraction of degrees function

2011-12-21 Thread Alaios
Dear all,   I have the following written example > coords <- "51°30'48.58\"N" > > as.integer(strsplit(coords, "°")[[1]][1]) [1] 51 > as.integer(strsplit(strsplit(coords, "°")[[1]][2], "'")[[1]][1]) [1] 30 > as.numeric(strsplit(strsplit(strsplit(coords, "°")[[1]][2], "'")[[1]][2], > "\"")[[1]][1]