Sadz A <sadz_a1000 <at> 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(D==0,1,sign(D))*decimal work? ______________________________________________ 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.