Skip to content

Error in if (type == "factor") { : argument is of length zero #30

@lzxcvn

Description

@lzxcvn

Greetings, I encountered a quandary whilst executing the program. Upon meticulous examination of my data, all appears to be in order, devoid of discrepancies. Might I inquire as to the location of the error within my code?

mydata=read.table('huizong11.txt',sep = '\t',header = T)
mydata$CEA=as.numeric(mydata$CEA)
mydata$CEA2=as.factor(mydata$CEA2)
mydata$CA125=as.numeric(mydata$CA125)
mydata$CA1252=as.factor(mydata$CA1252)
mydata$cyfra211=as.numeric(mydata$cyfra211)
mydata$cyfra2112=as.factor(mydata$cyfra2112)
mydata$diameter=as.numeric(mydata$diameter)
mydata$diameter2=as.factor(mydata$diameter2)
mydata$LVI=as.factor(mydata$LVI)
mydata$disease=as.factor(mydata$disease)
mydata$symptom=as.factor(mydata$symptom)
mydata$smoke=as.factor(mydata$smoke)
mydata$surgery1=as.factor(mydata$surgery1)
mydata$age=as.numeric(mydata$age)
mydata$age1=as.factor(mydata$age1)
mydata$sex=as.factor(mydata$sex)
mydata$subtype4=as.factor(mydata$subtype4)
mydata$wei1<-as.factor(mydata$wei1)
mydata$wei2<-as.factor(mydata$wei2)
mydata$wei2.1<-as.factor(mydata$wei2.1)
mydata$local<-as.factor(mydata$local)
mydata$nian<-as.factor(mydata$nian)
mydata$NLR<-as.numeric(mydata$NLR)
mydata$PLR<-as.numeric(mydata$PLR)
mydata$recrudescence1<-as.numeric(mydata$recrudescence1)
mydata$PFS<-as.numeric(mydata$PFS)
library(cureit)
library(ROCR)
library(evacure)
library(MASS)
str(mydata)
'data.frame': 1064 obs. of 27 variables:
$ num : int 670 673 678 682 683 686 692 729 730 732 ...
$ CEA : num 2.15 0.27 0.2 2.2 0.9 3.3 1.4 2.7 1.7 0.91 ...
$ CEA2 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ CA125 : num 7.84 1.95 4.32 5.78 5.9 ...
$ CA1252 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 2 1 1 1 ...
$ cyfra211 : num 0.47 0.1 0.51 3.45 6.02 5.12 0.59 3.2 4.49 0.15 ...
$ cyfra2112 : Factor w/ 2 levels "0","1": 1 1 1 2 2 2 1 1 2 1 ...
$ nian : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ diameter : num 0.6 1.1 0.9 0.9 2.6 1.8 0.8 1 1.4 1.6 ...
$ diameter2 : Factor w/ 3 levels "0","1","2": 1 2 1 1 3 2 1 1 2 2 ...
$ LVI : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ disease : Factor w/ 2 levels "0","1": 1 2 1 1 2 1 1 2 2 1 ...
$ symptom : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 2 1 1 ...
$ smoke : Factor w/ 2 levels "0","1": 1 2 1 1 1 1 1 1 1 1 ...
$ surgery1 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 2 2 2 2 ...
$ age : num 74 70 60 55 81 68 41 70 81 76 ...
$ age1 : Factor w/ 2 levels "0","1": 2 2 2 1 2 2 1 2 2 2 ...
$ sex : Factor w/ 2 levels "0","1": 2 2 1 2 2 1 1 1 2 1 ...
$ subtype4 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ wei1 : Factor w/ 2 levels "0","1": 1 1 1 1 2 1 1 1 1 1 ...
$ wei2 : Factor w/ 2 levels "0","1": 1 1 1 1 2 1 1 1 1 1 ...
$ wei2.1 : Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ...
$ local : Factor w/ 5 levels "1","2","3","4",..: 4 4 1 3 3 4 4 4 3 5 ...
$ NLR : num 1.7 1.7 0.9 1.8 2.9 1.1 2.6 1.9 1.8 0.8 ...
$ PLR : num 126.8 122.2 71.2 205.9 118.1 ...
$ recrudescence1: num 0 0 0 0 0 0 0 0 0 0 ...
$ PFS : num 66 79 69 66 80 78 107 80 105 122 ...
mydata$PFS=as.numeric(mydata$PFS)
p<-cureit(

  • surv_formula=Surv(PFS,recrudescence1==1)~CEA+diameter+cyfra211+CA125+age,
  • cure_formula=~CEA+diameter+cyfra211+CA125+age,
  • offset = NULL,
  • data=mydata
  • na.action = na.omit,

  • model = c("ph"),

  • link = "logit"

  • Var = TRUE,

  • emmax = 50,

  • eps = 1e-07,

  • nboot = 100,

  • n_post = 100,

  • init = NULL,

  • em = "smcure",

  • cutpoint = c(0.1,0.25, 0.5, 0.75, 0.9),

  • eva_model = NULL,

  • est_type = "EM",

  • posterior = TRUE

  • )
    Warning message:
    0 of 100 did not converge.

.calc_k_index(p)
[1] 0.5450771
nomogram(x = p,time=30)
Error in if (type == "factor") { : argument is of length zero

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions