FinancialInstrument (version 1.3.1)

month_cycle2numeric: coerce month_cycle to a numeric vector

Description

This will convert month codes or month names to numeric months.

Usage

month_cycle2numeric(...)

MC2N(...)

Arguments

...

the expiration months of a future. See examples.

Value

numeric vector

Details

Input can be a vector, comma-delimited string, or multiple strings. All inputs should be similar. Do not mix month names, codes and numbers in the same call.

MC2N is an alias

See Also

M2C, C2M, next.future_id future

Examples

Run this code
# NOT RUN {
MC2N("H,M,U,Z") # from single string
MC2N(c("H","M","U","Z")) # from single vector
MC2N("h", "M", "u", "Z") # from multiple strings
MC2N(c("F","G"), "H", c("X","Z")) # from multiple vectors
month_cycle2numeric("Mar,jun,SEP,dEc") 
month_cycle2numeric("Mar", "jun", "SEP", "dEc")
MC2N("March,june,sep,decem")
MC2N("March, june, sep, decem") #spaces between commas are ok
month_cycle2numeric("3,6,9,12")
month_cycle2numeric(seq(3,12,3))
# }

Run the code above in your browser using DataLab