'Why does deparse return a vector of length two here?
I need to deparse within R using deparse(...) which in all cases returned a vector of length one. But for the following I get a vector of length two:
> deparse(factor(All_cause_death, levels= c('Dead', 'Alive')) ~ Age_in_years + Systolic_Blood_pressure, backtick= TRUE)
[1] "factor(All_cause_death, levels = c(\"Dead\", \"Alive\")) ~ Age_in_years + "
[2] " Systolic_Blood_pressure"
If I shorten the first variable name a bit I indeed get the expected output of length one:
> deparse(factor(Death, levels= c('Dead', 'Alive')) ~ Age_in_years + Systolic_Blood_pressure, backtick= TRUE)
[1] "factor(Death, levels = c(\"Dead\", \"Alive\")) ~ Age_in_years + Systolic_Blood_pressure"
In the code above I shortened the input by 10 elements by changing "All_cause_death" to "Death". Interestingly, if I shorten the input by 10 elements (or more) at the end of the input I do not get vector of length one:
> deparse(factor(All_cause_death, levels= c('Dead', 'Alive')) ~ Age_in_years + Systolic_, backtick= TRUE)
[1] "factor(All_cause_death, levels = c(\"Dead\", \"Alive\")) ~ Age_in_years + "
[2] " Systolic_"
Why is this happening and how can I get a vector of length one for the first code?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
