[R] [cph] Error in [.default (y, , 3) : subscript out of bounds
    Huy Nguyen 
    huynguyen96@dnu @end|ng |rom gm@||@com
       
    Sat Jan 25 14:58:04 CET 2020
    
    
  
Dear CRAN support team,
I have been facing with an error when using the package *cph* to construct
nomogram! Let me clarify what exactly I have been encountered.
Firstly, this is a summary of my data:
 > str(train)
 'data.frame': 1323 obs. of  25 variables:
  $ LYMPH_NODES_EXAMINED_POSITIVE: Factor w/ 3 levels "<=3","<=9",">10": 3
NA 1 2 NA 1 NA 1 3 1 ...
  $ CELLULARITY                  : Factor w/ 3 levels
"High","Low","Moderate": NA 1 3 1 3 3 1 3 NA 1 ...
 $ MENOPAUSAL_STATE             : Factor w/ 2 levels "Post","Pre": 1 2 2 1
1 1 1 1 NA 2 ...
  $ ER_STATUS                    : Factor w/ 2 levels
 "Negative","Positive": 2 2 2 2 2 2 1 2 2 1 ...
 $ OS_MONTHS                    : num  718 425 822 186 16 816 77 514 NA
 821 ...
 $ OS_STATUS                    : Factor w/ 2 levels "DECEASED","LIVING": 2
2 2 1 1 2 1 1 NA 2 ...
 $ LATERALITY                   : Factor w/ 2 levels "Left","Right": 2 2 2
2 1 2 1 1 NA 2 ...
and this is my code:
> attach(train);d <- datadist(CELLULARITY, MENOPAUSAL_STATE, ER_STATUS,
     LATERALITY, LYMPH_NODES_EXAMINED_POSITIVE)
>  options(datadist = 'd')
>      mod.cox <- cph(formula(Surv(OS_MONTHS, OS_STATUS) ~ CELLULARITY +
MENOPAUSAL_STATE + ER_STATUS + LATERALITY +LYMPH_NODES_EXAMINED_POSITIVE),
data=train, x= TRUE, y= TRUE, surv = TRUE)
Right there, I got the error when running mod.cox:
*Error in  [.default (y, , 3) : subscript out of bounds*
I did some researches and found this previous issue
<https://github.com/harrelfe/rms/issues/31> and this
<https://github.com/harrelfe/rms/issues/25> related, which solved by
Prof.Harrelfe. But, It seems not working to me.
Any helps would be appreciated.
The example data that produces the same error:
https://drive.google.com/open?id=1Bi9nfg34eByc5H1Bmmq43dz6O8lEaj5O
Best regards,
Huy Nguyen
	[[alternative HTML version deleted]]
    
    
More information about the R-help
mailing list