使用survRM2包中的rmst2函数时如何解决“Object 'Note' not find error”?

问题描述 投票:0回答:2

我的目的是比较安德森数据集中两个治疗组之间的限制平均生存时间 安德森数据集

这是我的数据框的结构:

    'data.frame':   42 obs. of  5 variables:
 $ survt : num  19 17 13 11 10 10 9 7 6 6 ...
 $ status: num  0 0 1 0 0 1 0 1 0 1 ...
 $ sex   : Factor w/ 2 levels "female","male": 1 1 1 1 1 1 1 1 1 1 ...
 $ logwbc: 'labelled' num  2.05 2.16 2.88 2.6 2.7 2.96 2.8 4.43 3.2 2.31 ...
  ..- attr(*, "label")= Named chr "log WBC"
  .. ..- attr(*, "names")= chr "logwbc"
 $ rx    : Factor w/ 2 levels "New treatment",..: 1 1 1 1 1 1 1 1 1 1 ...
  ..- attr(*, "label")= Named chr "Treatment"
  .. ..- attr(*, "names")= chr "rx"
 - attr(*, "codepage")= int 65001

我使用以下代码来比较两个治疗组之间的受限平均生存时间(“新治疗”与“标准治疗”):

time <- anderson$survt
status <- anderson$status
arm <- anderson$rx
rmst2(time, status, arm )

我收到以下错误:

Error in rmst2(time, status, arm) : object 'NOTE' not found
In addition: Warning messages:
1: In max(tt) : no non-missing arguments to max; returning -Inf
2: In min(ss[tt == tt0max]) :
  no non-missing arguments to min; returning Inf
3: In max(tt) : no non-missing arguments to max; returning -Inf
4: In min(ss[tt == tt1max]) :
  no non-missing arguments to min; returning Inf

谢谢

survival-analysis
2个回答
0
投票

我将性别和 rx 变量从因子转换为数字,并且该函数起作用了。


0
投票

(将处理变量从字符转换为数字)也为我解决了这个问题。需要查看该函数实际执行的操作,其结果对象也可以通过plot()传递。

© www.soinside.com 2019 - 2024. All rights reserved.