month_cnv: Convert between a month name and the equivalent number

Description Usage Arguments Details Value Author(s) Examples

Description

Convert between a month name and the equivalent number

Usage

1
month_cnv(monthinput, up=FALSE, short=FALSE)

Arguments

monthinput

either a string ('January', 'Jan', 'Decem', etc.) or a number from 1 to 12, scalar or array.

up

if =TRUE and if a string is being returned, it will be in all uppercase letters. If = FALSE, all lowercase letters are used (default = FALSE)

short

if =TRUE and if a string is being returned, only the first three letters are returned (default = FALSE)

Details

For example, this function converts from 'January' to 1, or vice-versa. String output can be in the form "january", "JANUARY", "jan", "JAN".

Value

If the input is a string, the output is the matching month number.If an input string is not a valid month name, -1 is returned.
If the input is a number, the output is the matching month name. See details for formats.

Author(s)

Written by: Joel Wm. Parker, SwRI, 1998

R adaptation by Arnab Chakraborty June 2013

Examples

1
2
month_cnv('Apr')
month_cnv(4,short=TRUE,up=TRUE)

astrolibR documentation built on May 2, 2019, 3:26 a.m.