I thought it was for turning a xts object to its original class, but after I pass an xts object into it, it did not give me the original object back. What does it for?
My attempt
data(sample_matrix)
class(sample_matrix)
#"matrix"
class(reclass(as.xts(sample_matrix)))
#"xts" "zoo"
From the docs
try.xts and reclass are functions that enable external developers access to the reclassing tools within xts to help speed development of time-aware functions, as well as provide a more robust and seemless end-user experience, regardless of the end-user's choice of data-classes.
if you use try.xts to convert a xtsible object to xts object , reclass or Reclass both should be able to convert it back to it's original class with all attributes intact.
class(Reclass(try.xts(sample_matrix)))
## [1] "matrix"
class(reclass(try.xts(sample_matrix)))
## [1] "matrix"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With