You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I am encountering an error when trying to run summary.survfit() on a survfit.coxphms object with data.frame = TRUE. The error is always of the form:
> Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
arguments imply differing number of rows: .......
This error is thrown upon the execution of this line:
# Prepare the mgus2 dataset.
mgus2$etime <- with(mgus2, ifelse(pstat == 0, futime, ptime))
event <- with(mgus2, ifelse(pstat == 0, 2 * death, 1))
mgus2$event <- factor(event, 0:2, labels = c("censor", "pcm", "death"))
# Fit Cox PH model
msfit <- coxph(
Surv(etime, event) ~ age + sex,
data = mgus2, id = id
)
# The following ndata causes an error
ndata <- mgus2[1:2, c("age", "sex")]
sf <- survfit(msfit, ndata)
summary(sf, data.frame = TRUE)
# > Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE, :
# arguments imply differing number of rows: 1284, 1926
Investigating further, the error occurs whenever the number of rows in ndata is not a multiple of 3.
The example below tries ndata lengths from 1-30 and returns the ones that did not cause the error.
Hello,
I am encountering an error when trying to run
summary.survfit()
on asurvfit.coxphms
object withdata.frame = TRUE
. The error is always of the form:This error is thrown upon the execution of this line:
survival/R/summary.survfitms.R
Line 208 in 9ea6560
MVE on
mgus2
:Investigating further, the error occurs whenever the number of rows in
ndata
is not a multiple of 3.The example below tries
ndata
lengths from 1-30 and returns the ones that did not cause the error.Thank you for your help.
The text was updated successfully, but these errors were encountered: