Skip to content

ensure survival vectors are unnamed for #1023 #1024

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

Merged
merged 2 commits into from
Nov 14, 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 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", , "max@posit.co", role = c("aut", "cre")),
person("Davis", "Vaughan", , "davis@posit.co", 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