Closed katiasilva closed 12 years ago
when you say data$FC_NYHA_before._PM you are stating that "there is a variable called FC_NYHA_before._PM that is part of data object called data, but in your case your data object is called qol_data
Katia, the main principle is that you take a piece of code that has worked before and transform that into what you might want. so, here is something that worked before from your script:
age_cat <- car::recode(Age_PM_implantation, " 0:1 = 1; 2:8 = 2; NA = NA; else = 3 ") tabulate(age_cat)
if you take this and transform to the variable you want you will have
FC_NYHA_before._PM <- car::recode(FC_NYHA_before._PM, " 'I' = 1; 'II' = 2; 'III'=3; '' = NA; else = 3 ") tabulate(FC_NYHA_before._PM)
you write 'I' because FC_NYHA_before._PM is a factor, whereas in the case of Age_PM_implantation it was a numeric variable and so you were writing numbers like 0:1, 2:8. makes sense?
On Wed, Jun 13, 2012 at 11:16 PM, katiasilva < reply@reply.github.com
wrote:
I am trying to recode FC NYHA in two classes. I have FC NYHA I, II, III.
I found one explanation on the internet. But, I did not understand.
data$FC_NYHA_before._PM <- factor(data$FC_NYHA_before._PM) data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="I"] <- "1" data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="II"] <- "2" data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="III"] <- "2"
data$FC_NYHA_before._PM <- factor(data$FC_NYHA_before._PM) Error in data$FC_NYHA_before._PM : object of type 'closure' is not subsettable data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="I"] <- "1" Error in
*tmp*
$FC_NYHA_before._PM : object of type 'closure' is not subsettable data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="II"] <- "2" Error in*tmp*
$FC_NYHA_before._PM : object of type 'closure' is not subsettable data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="III"] <- "2" Error in*tmp*
$FC_NYHA_before._PM : object of type 'closure' is not subsettable
Reply to this email directly or view it on GitHub: https://github.com/rpietro/QoLFunctionalCapacityAVBlock/issues/6
I am trying to recode FC NYHA in two classes. I have FC NYHA I, II, III.
I found one explanation on the internet. But, I did not understand.
data$FC_NYHA_before._PM <- factor(data$FC_NYHA_before._PM) data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="I"] <- "1" data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="II"] <- "2" data$FC_NYHA_before._PM[data$FC_NYHA_before._PM=="III"] <- "2"