rpietro / EsophagealCancerT1N0

Evaluating outcomes after Esophageal cancer T1N0
0 stars 0 forks source link

why do I get this error message for CrossTable? #4

Closed mworni closed 12 years ago

mworni commented 12 years ago

This is the code I used aiming to create a variable competing_risk that will be used for cancer specific survival KM plots:

competing_risk <- NA competing_risk[os_death=0] <- 0 competing_risk[os_death=1] <- 2 competing_risk[css_death=1] <- 1 competing_risk <- as.factor(competing_risk) levels(competing_risk) class(competing_risk) CrossTable(competing_risk, css_death, missing.include=TRUE)

Whenever I try to check if my variable creation worked, I get the following error message: Error in CrossTable(competing_risk, css_death, missing.include = TRUE) : x and y must have the same length

rpietro commented 12 years ago

= means <- == means test if they are equal

competing_risk <- NA competing_risk[os_death==0] <- "alive" competing_risk[os_death==1] <- "dead" competing_risk[css_death==1] <- "css_dead" competing_risk <- as.factor(competing_risk) tabulate(competing_risk) class(competing_risk) CrossTable(competing_risk, css_death, missing.include=TRUE)

other suggestions from looking at the script:

  1. would delete everything that you are not using
  2. make your data object name short so that you can use it later without having to write a novel-length kind of script

On Thu, Jun 28, 2012 at 2:49 PM, mworni < reply@reply.github.com

wrote:

This is the code I used aiming to create a variable competing_risk that will be used for cancer specific survival KM plots:

competing_risk <- NA competing_risk[os_death=0] <- 0 competing_risk[os_death=1] <- 2 competing_risk[css_death=1] <- 1 competing_risk <- as.factor(competing_risk) levels(competing_risk) class(competing_risk) CrossTable(competing_risk, css_death, missing.include=TRUE)

Whenever I try to check if my variable creation worked, I get the following error message: Error in CrossTable(competing_risk, css_death, missing.include = TRUE) : x and y must have the same length


Reply to this email directly or view it on GitHub: https://github.com/rpietro/EsophagealCancerT1N0/issues/4