Skip to content

Commit 8c08c65

Browse files
authored
ensure survival vectors are unnamed for #1023 (#1024)
* ensure survival vectors are unnamed for #1023 * move standalone tests to extratests
1 parent 86f8a4e commit 8c08c65

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: parsnip
22
Title: A Common API to Modeling and Analysis Functions
3-
Version: 1.1.1.9001
3+
Version: 1.1.1.9002
44
Authors@R: c(
55
person("Max", "Kuhn", , "max@posit.co", role = c("aut", "cre")),
66
person("Davis", "Vaughan", , "davis@posit.co", role = "aut"),

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

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

23+
* When computing censoring weights, the resulting vectors are no longer named (#1023).
24+
2325
# parsnip 1.1.0
2426

2527
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.

R/standalone-survival.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#
1818
# 2023-06-14
1919
# * removed time to factor conversion
20+
#
21+
# 2023-11-09
22+
# * make sure survival vectors are unnamed.
2023

2124
# @param surv A [survival::Surv()] object
2225
# @details
@@ -74,6 +77,8 @@
7477
res <- surv[, colnames(surv) %in% keepers]
7578
if (NCOL(res) > 1) {
7679
res <- tibble::tibble(as.data.frame(res))
80+
} else {
81+
res <- unname(res)
7782
}
7883
res
7984
}
@@ -88,6 +93,6 @@
8893
(identical(un_vals, 1:2) | identical(un_vals, c(1.0, 2.0))) ) {
8994
res <- res - 1
9095
}
91-
res
96+
unname(res)
9297
}
9398
# nocov end

0 commit comments

Comments
 (0)