Skip to content

Commit

Permalink
Set .ROWNAMES attr before dropping row names
Browse files Browse the repository at this point in the history
The previous commit removed row names from the object returned by
.xts(), but it did not set the .ROWNAMES attribute. This broke several
tests that attempted to reclass objects back to their original class.

This commit fixes those tests, while preserving the behavior that
removes row names from the object returned by .xts().

Fixes #298. (for real)
  • Loading branch information
joshuaulrich committed Aug 8, 2020
1 parent d0b7e8d commit 3e13355
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/xts.R
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ function(x=NULL, index, tclass=c("POSIXct","POSIXt"),
c('xts','zoo'), tformat, PACKAGE='xts')

# ensure there are no rownames
if(!is.null((dimnames(xx)))) {
rn <- dimnames(xx)[[1]]
if(!is.null(rn)) {
attr(xx, '.ROWNAMES') <- rn
dimnames(xx)[[1]] <- NULL
}

Expand Down

0 comments on commit 3e13355

Please sign in to comment.