Learn R Programming

astroFns (version 4.2-1)

hms2rad: Hours, minutes, and seconds to radians

Description

Angular conversion from hours, minutes, and seconds to radians.

Usage

hms2rad(h = '12h 3m 45.6s')

Arguments

h

String hours, minutes, and seconds

Value

Angle in radians.

Details

Function reads a string (the input is a string to allow conversion of angles between -1 and zero hours) with hours, minutes, and seconds separated by any of characters d, m, s, a colon, or a comma. Spaces are not valid separators, as they are removed as part of input parsing. Zeros are the default if values for minutes or seconds are missing from the string. A minus sign before the hours indicates negative hours. Decimal values are allowed in any position.

See Also

dms2rad, rad2hms, rad2dms

Examples

Run this code
# NOT RUN {
hms2rad('10, 22, 14')
hms2rad('-0:30')
hms2rad('0h30')
# }

Run the code above in your browser using DataLab