Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- other_replace <- function(df,column_name,other_month,other_ei,wrong)
- {
- require("dplyr")
- other_month <- as.name(other_month)
- other_ei <- as.name(other_ei)
- equipt <- c("ov_ap","rub_bo","wrk_bo","mask","gog","glov","non")
- for(i in equipt){
- column_name<- as.name(paste(c(column_name,i),sep="_"))
- column_name2 <- as.name(paste("p17a.1.gear_othcon",i,sep="_"))
- df <- df %>% mutate(column_name=ifelse(other_month==wrong|
- other_ei==wrong,
- replace(column_name,column_name2=="1","1"),
- column_name))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement