If you have a fresh R session (no packages other than the base ones), and try creating the next xts object ordered by the yearmon class ...
df <- data.frame(date = zoo::as.yearmon(seq.Date(as.Date("2015-01-01"),
as.Date("2015-12-31"),
by = "month")),
num = rnorm(12, 0, 1))
dates <- df[,1]
xts::xts(as.matrix(df[, -1]), order.by = dates)
The following error appears.

I thought I understood the scope of the R namespace, but in this case I was completely lost. Why does this xts try to call the as.yearmon function when the date object is already a yearmon object? I know that xts depends on the zoo, but is there a reason?
If the zoo is attached, then, of course, the error disappears.
, , , , xts. xts, , R , ( ) . - zoo, .
, - , , , SO, . !