Hi, newbie here, so I'm working on recoding my dataset.
I've successfully recoded all of the items that similar to this
PD_dataset_clean$LPSF_80 <- recode(PD_dataset_clean$LPSF_80,
"'Totally False, not at all True' = 1;
'Slightly True' = 2;
'Mainly True' = 3;
'Very True' = 4")
however, when i run this:
PD_dataset_clean$ders_5 <- recode(PD_dataset_clean$ders_5,
"'Almost never (0-10%)' = 1;
'Sometimes (11-35%)' = 2;
'About half the time (36-65%)' = 3;
'Most of the time (66-90%)' = 4;
'Almost always (91-100%)' = 5")
It successfully runs but it doesn't code in my dataset.
I also tried:
PD_dataset_clean$ders_3 <- recode(PD_dataset_clean$ders_3,
'Almost never (0-10%)' ~ 1,
'Sometimes (11-35%)' ~ 2,
'About half the time (36-65%)' ~ 3,
'Most of the time (66-90%)' ~ 4,
'Almost always (91-100%)' ~ 5)
and this error comes up: Error in if (grepl(paste0("[", separator, interval, "]"), to.value)) stop("to.value may not contain ", :
the condition has length > 1
i also tried:
PD_dataset_clean$ders_5 <- (recode(PD_dataset_clean$ders_5,
'Almost never (0-10%)'= 1,
'Sometimes (11-35%)'= 2,
'About half the time (36-65%)'= 3,
'Most of the time (66-90%)'= 4,
'Almost always (91-100%)'= 5)
this error comes up:
Error in recode(PD_dataset_clean$ders_5, Almost never (0-10%)
= 1, :
unused arguments (Almost never (0-10%)
= 1, Sometimes (11-35%)
= 2, About half the time (36-65%)
= 3, Most of the time (66-90%)
= 4, Almost always (91-100%)
= 5)
if i replace the commas with semicolons it says unexpected ";"
I'm not sure why everything else is coding except my "DERS" variables. Please let me know some other ways to recode or what's going wrong here. Thanks!