The as.xts() function currently returns an object with a POSIXct index, unless you specify otherwise via the dateFormat argument.
library(xts)
data(sample_matrix)
p <- as.xts(sample_matrix)
d <- as.xts(sample_matrix, dateFormat = "Date")
This can be confusing to users who expect to be able to do things like this without issue:
d <- head(as.xts(sample_matrix, dateFormat = "Date"))
r <- as.xts(t(apply(d, 1, rank)))
merge(r, d)
merge(d, r)
It doesn't seem completely unreasonable for as.xts to return an object with a Date index, so that r could be easily merged with d. (The fact that merge(r, d) and merge(d, r) return different results is discussed in #191.)
The
as.xts()
function currently returns an object with aPOSIXct
index, unless you specify otherwise via thedateFormat
argument.This can be confusing to users who expect to be able to do things like this without issue:
It doesn't seem completely unreasonable for
as.xts
to return an object with a Date index, so thatr
could be easily merged withd
. (The fact thatmerge(r, d)
andmerge(d, r)
return different results is discussed in #191.)