[R] Complete month name from as.yearmon()

Enrico Schumann e@ @end|ng |rom enr|co@chum@nn@net
Sat Apr 13 13:44:07 CEST 2019


>>>>> "CB" == Christofer Bogaso <bogaso.christofer using gmail.com> writes:

    CB> Hi,
    CB> I am wondering if there is any way to get the full name from as.yearmon()
    CB> function. Please consider below example:

    CB> library(quantmod)
    CB> as.yearmon(Sys.Date())

    CB> This gives: [1] "Apr 2019".

    CB> How can I extract the full name ie. 'April 2019'

    CB> Appreciate your pointer. Thanks,


library("zoo")   ## where 'as.yearmon' comes from
format(as.yearmon(Sys.Date()), "%B %Y")
## [1] "April 2019"

Note that this will give you the full monthname in your
locale.


-- 
Enrico Schumann
Lucerne, Switzerland
http://enricoschumann.net



More information about the R-help mailing list