This probably doesn't count as simple, but you can convert your format, call
it degrees.minutes, to decimal degrees, do the math and then convert back. The
functions would be simple:
dm2dd <- function(x) trunc(x) + (x - trunc(x))/60*100
dd2dm <- function(x) trunc(x) + (x - trunc(x))*60/100
So your problem would be
> dd2dm(dm2dd(44.1) - dm2dd(.2))
[1] 43.5
Of course you could wrap that into a function if you are planning to do it
frequently.
-------------------------------------
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77840-4352
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Trevor Davies
Sent: Thursday, June 26, 2014 2:43 PM
To: r-help at r-project.org
Subject: [R] subtracting degree minutes
Is there a simple way to subtract base-60 (coordinate system) values?
A trivial example:
I have a Lat of 44.1 degrees and I want to subtract 0.2 degrees from it.
Therefore the answer should be 43.5 degrees (base 60).
I can do a change to character; stringsplit ; change back - deal with the
leading zeros but there must be an easier way. (?)
Thanks for the help.
Trevor
[[alternative HTML version deleted]]
______________________________________________
R-help at 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.