Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix drop = FALSE to drop = TRUE #118

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
## Bug fixes

- `sv_dependence2D()`: In case `add_vars` are passed, `x` and/or `y` are removed from it in order to not use any variable twice. [#116](https://github.com/ModelOriented/shapviz/pull/116).
- `split.shapviz()` now drops empty levels. They launched an error because empty "shapviz" objects are currently not supported. [#117](https://github.com/ModelOriented/shapviz/pull/117)
- `split.shapviz()` now drops empty levels. They launched an error because empty "shapviz" objects are currently not supported. [#117](https://github.com/ModelOriented/shapviz/pull/117), [#118](https://github.com/ModelOriented/shapviz/pull/118)

# shapviz 0.9.2

Expand Down
6 changes: 3 additions & 3 deletions R/methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ c.shapviz <- function(...) {
#'
#' @param x Object of class "shapviz".
#' @param f Vector used to split feature values and SHAP (interaction) values.
#' @param ... Arguments passed to `split()`. Don't pass `drop = TRUE` as empty
#' "shapviz" objects are rejected.
#' Empty factor levels are dropped.
#' @param ... Arguments passed to `split()`.
#' @returns A "mshapviz" object.
#' @examples
#' \dontrun{
Expand All @@ -368,7 +368,7 @@ c.shapviz <- function(...) {
#' @export
#' @seealso [shapviz()], [rbind.shapviz()]
split.shapviz <- function(x, f, ...) {
ind <- split(seq_len(nrow(x)), f = f, drop = FALSE, ...)
ind <- split(seq_len(nrow(x)), f = f, drop = TRUE, ...)
mshapviz(lapply(ind, function(i) x[i, ]))
}

Expand Down
6 changes: 3 additions & 3 deletions man/split.shapviz.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.