Skip to content

Commit

Permalink
ensure survival vectors are unnamed for #1023 (#1024)
Browse files Browse the repository at this point in the history
* ensure survival vectors are unnamed for #1023

* move standalone tests to extratests
  • Loading branch information
topepo authored Nov 14, 2023
1 parent 86f8a4e commit 8c08c65
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: parsnip
Title: A Common API to Modeling and Analysis Functions
Version: 1.1.1.9001
Version: 1.1.1.9002
Authors@R: c(
person("Max", "Kuhn", , "[email protected]", role = c("aut", "cre")),
person("Davis", "Vaughan", , "[email protected]", role = "aut"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

* Fixed bug where `boost_tree()` models couldn't be fit with 1 predictor if `validation` argument was used. (#994)

* When computing censoring weights, the resulting vectors are no longer named (#1023).

# parsnip 1.1.0

This release of parsnip contains a number of new features and bug fixes, accompanied by several optimizations that substantially decrease the time to `fit()` and `predict()` with the package.
Expand Down
7 changes: 6 additions & 1 deletion R/standalone-survival.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#
# 2023-06-14
# * removed time to factor conversion
#
# 2023-11-09
# * make sure survival vectors are unnamed.

# @param surv A [survival::Surv()] object
# @details
Expand Down Expand Up @@ -74,6 +77,8 @@
res <- surv[, colnames(surv) %in% keepers]
if (NCOL(res) > 1) {
res <- tibble::tibble(as.data.frame(res))
} else {
res <- unname(res)
}
res
}
Expand All @@ -88,6 +93,6 @@
(identical(un_vals, 1:2) | identical(un_vals, c(1.0, 2.0))) ) {
res <- res - 1
}
res
unname(res)
}
# nocov end

0 comments on commit 8c08c65

Please sign in to comment.