joshuaulrich / xts

Extensible time series class that provides uniform handling of many R time series classes by extending zoo.
http://joshuaulrich.github.io/xts/
GNU General Public License v2.0
220 stars 71 forks source link

Add option to warn about deprecated attributes #306

Closed joshuaulrich closed 1 year ago

joshuaulrich commented 5 years ago

There are several warnings about the deprecated attributes that were (re)moved in #245. These may be extremely verbose in some cases, and may cause errors in other cases. For example, an error occurred in the reverse dependency check for the 'portfolioBacktest' package, when foreach() %dopar% was called with a 'snow' backend.

Make these warnings conditional on a global option (e.g. xts_warn_deprecated). Set the option to FALSE by default, and add a message to .onAttach() to suggest users run their scripts with it set to TRUE. The default will be set to TRUE on the next non-patch release.

braverock commented 1 year ago

The warning should point to a note in the documentation about how to fix this issue. A Google search for the error message doesn't lead to anything useful either.

braverock commented 1 year ago
# if 'x' is an outdated xts object:
tclass(x) <- "Date"
tzone(x) <- "UTC"

The setters remove the attributes from the xts object and put them on the index.