Re: [R] Changing sign on absolute numbers 0 problems

2010-10-21 Thread Keith Jewell
else(dd==0,sign(dd))) * (abs(dd) + mm / 60 + ss >> / 3600) >> Lat<-strapply(x, "(.*):(.*):(.*)", Convert, simplify = TRUE) >> Lat >> >> #so I now have the correct absolute decimal degrees in all cases and the >> correct direction in all cases ex

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-21 Thread Sadz A
Thank you so much! From: David Winsemius Cc: r-help r-help Sent: Thu, 21 October, 2010 15:43:37 Subject: Re: [R] Changing sign on absolute numbers 0 problems With permission I am copying a private communication to the list. On Oct 21, 2010, at 9:20 AM, Sadz

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-21 Thread David Winsemius
sign from MD_LATITUD, so that I can change # 'Convert <- function(d, m, s, dd = as.numeric(d), mm = as.numeric(m), ss = as.numeric(s)) sign(dd) * (abs(dd) + mm / 60 + ss / 3600)' to something like # 'Convert <- function(sign, d, m, s, dd = as.numeric(d), mm = as.numeric

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-21 Thread Keith Jewell
"Sadz A" wrote in message news:419230.77523...@web24610.mail.ird.yahoo.com... > Hi, > > I am trying to do some calculations turning DMS data to decimal degrees > using > the formula (D+(M/60)+(S/3600)), some of the D's involve -ve numbers, the > easiest way to do the calculation is to use absol

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-20 Thread Brian Diggs
On 10/20/2010 12:25 PM, Ben Bolker wrote: Sadz A yahoo.co.uk> writes: This works fine untill D=0 because then 'sign' does not give 0 a +ve sign it takes it as 0 and multiplies decimal by 0 to give 0. example D<-0 decimal<-D+(M/60)+(S/3600) decimal.degs<-sign(D)*decimal decimal.degs 0 d

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-20 Thread David Winsemius
On Oct 20, 2010, at 3:19 PM, David Winsemius wrote: On Oct 20, 2010, at 11:47 AM, Sadz A wrote: Hi, I am trying to do some calculations turning DMS data to decimal degrees using the formula (D+(M/60)+(S/3600)), some of the D's involve -ve numbers, the easiest way to do the calculation i

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-20 Thread Ben Bolker
Sadz A yahoo.co.uk> writes: > > This works fine untill D=0 > because then 'sign' does not give 0 a +ve sign it takes it as 0 and > multiplies > decimal by 0 to give 0. > example > D<-0 > decimal<-D+(M/60)+(S/3600) > decimal.degs<-sign(D)*decimal > decimal.degs > 0 > decimal.degs <- ifelse

Re: [R] Changing sign on absolute numbers 0 problems

2010-10-20 Thread David Winsemius
On Oct 20, 2010, at 11:47 AM, Sadz A wrote: Hi, I am trying to do some calculations turning DMS data to decimal degrees using the formula (D+(M/60)+(S/3600)), some of the D's involve -ve numbers, the easiest way to do the calculation is to use absolute numbers then use the 'sign' functi

[R] Changing sign on absolute numbers 0 problems

2010-10-20 Thread Sadz A
Hi, I am trying to do some calculations turning DMS data to decimal degrees using the formula (D+(M/60)+(S/3600)), some of the D's involve -ve numbers, the easiest way to do the calculation is to use absolute numbers then use the 'sign' function in R to change the answer back to the correct -