hms2deg: Convert hms to degrees format.

Description Usage Arguments Value Author(s) See Also Examples

Description

Convert hms (hours, minutes, seconds) to degrees format. This is probably most useful for right ascension (RA) conversion, since hms is fairly standard method of presenting RA coordinates. The decimal degrees=15*h+15*m/60+15*s/3600. Should range between 0 and 24 hours. Hours and minutes should be integer and seconds can be decimal.

Usage

1
hms2deg(h,m,s,sep=':')

Arguments

h

The integer number of hours you are converting. If it is not integer then the floor of the number is taken. All m values should be 0<=h<=24.

m

The integer number of minutes you are converting. If it is not integer then the floor of the number is taken. All m values should be 0<=m<60.

s

The decimal number of seconds you are converting. All s values should be 0<=s<60.

sep

Defines the type of separator used when 'h' is a vector of strings. Any value other than 'HMS' and 'hms' is used for all separations, so the default ':' would be for an input like 3:34:45.5. If set to 'hms' or 'HMS' then the output is of the format 3h34m45.5s and 3H34M45.5s resepctively.

Value

A value of decimal degrees.

Author(s)

Aaron Robotham

See Also

deg2hms

Examples

1
2
3
4
hms2deg(12,10,36)
hms2deg('12:10:36')
hms2deg('12h10m36s',sep='hms')
hms2deg(c('12H10M36S','3H4M10S'),sep='HMS')

Example output

Loading required package: RANN
[1] 182.65
[1] 182.65
[1] 182.65
[1] 182.65000  46.04167

celestial documentation built on May 2, 2019, 3:05 p.m.