search for: reverse_list

Displaying 1 result from an estimated 1 matches for "reverse_list".

2008 May 19
2
recoding data with loops
..."HREVDIS2") for(i in 1:length(var_list)) {var_list[1] <- rnorm(100)} mdf <- data.frame(cbind(varlist[1:length(var_list)]) mdf # Then, I'd like to recode the variables that begin with the letter "H". # I've tried many variations of the following, but to no avail: reverse_list <- c("HEQUAL", "HREVDIS1", "HREVDIS2") reversed_list <- c("RHEQUAL", "RHREVDIS1", "RHREVDIS2") for(i in 1:length(reverse_list)) {mdf[ ,e_reversed_list][[i]] <- recode(mdf[ ,e_reverse_list][[i]], '5:99=NA; 1=4; 2=3; 3=2; 4=1;...