Search code examples
rsurvival

michiganCoxSurv and undefined columns selected


I have an input file that attempts to match the example given by the package (trimmed for MWE)

Data

structure(list(ID_1 = 1:4, ID_2 = c("MZGVVGDE", "MZDBADNE", "ZBAZDCC", 
"ZBCBEAAZ"), event = c(0L, 0L, 0L, 0L), age = c(44L, 62L, 67L, 
58L), age_diagnosis = c(40L, 57L, 54L, 5L)), class = "data.frame", row.names = c(NA, 
-4L))
ID_1 ID_2 event age age_diagnosis
1 MZGVVGDE 0 44 40
2 MZDBADNE 0 62 57
3 ZBAZDCC 0 67 54
4 ZBCBEAAZ 0 58 5

and the R code (trimmed down for MWE)

michiganCoxSurv(vcf.file=vcf.file,
                covariate.file=pheno.file,
                id.column="ID_2",
                sample.ids=sample.ids,
                time.to.event="time",
                event="event",
                covariates=c("age_diagnosis"),
                inter.term=NULL,
                print.covs="only",
                out.file="michigan_only",
                r2.filter=0.3,
                maf.filter=0.005,
                chunk.size=100,
                verbose=TRUE,
                clusterObj=NULL)

which produces the output:

Analysis started on 2020-08-11 at 15:10:18
Covariates included in the models are: age_diabetes_diagnosis
Error in `[.data.frame`(pheno.file, , c(id.column, time.to.event, event,  : 
  undefined columns selected
Calls: michiganCoxSurv -> coxPheno -> [ -> [.data.frame
Execution halted

How can I fix this error?


Solution

  • You've got time.to.event="time". There's no column named time in your pheno.file.