I see my pre-coffee fingering hit an incorrect key in the final
line--"E" is positive, "W" is negative.
--
Clint Bowman INTERNET: cl...@ecy.wa.gov
Air Quality Modeler INTERNET: cl...@math.utah.edu
Department of Ecology VOICE: (360) 407-6815
PO Box 47600 FAX: (360) 407-7534
Olympia, WA 98504-7600
USPS: PO Box 47600, Olympia, WA 98504-7600
Parcels: 300 Desmond Drive, Lacey, WA 98503-1274
On Wed, 21 Dec 2011, Clint Bowman wrote:
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(coords, "?")[[1]][2], "'")[[1]][2],
"\"")[[1]][2]
deg.frac<-((sec/60+min)/60+deg
deg.frac<-ifelse(nswe=="S"|nswe=="E",-deg.frac,deg.frac)
Clint
______________________________________________
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.