Skip to content

Commit 28ad722

Browse files
committed
last attempt at removing rownames
1 parent 84e7f34 commit 28ad722

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

R/compat-plyr.R

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ unrowname <- function(x) {
1919
} else if (is.matrix(x)) {
2020
dimnames(x)[1] <- list(NULL)
2121
} else {
22-
cli::cli_abort("Can only remove rownames from {.cls data.frame} and {.cls matrix} objects.")
22+
try_fetch(
23+
{
24+
rownames(x) <- NULL
25+
},
26+
error = function(cnd) {
27+
cli::cli_abort(
28+
"Can only remove rownames from {.cls data.frame} and {.cls matrix} objects.",
29+
parent = cnd
30+
)
31+
}
32+
)
2333
}
2434
x
2535
}

0 commit comments

Comments
 (0)