I am a little confused about mutate function in dplyr. I have a binary data frame and I want to create a new column with mutate. Here is what I want to do:
author_dist <-
  dist_df %>%
  mutate_each(funs(gsub("T.*","",.)),-distance) %>% 
  mutate_each(funs(ifelse(nchar(.)<3,gsub("A","A0",.),.)),-distance) %>% 
  group_by(Sentence1,Sentence2) %>% 
  summarise(avg_dist=mean(distance)) %>% 
but when I try to run the code I get a warning:
mutate_each()is deprecated. Usemutate_all(),mutate_at()ormutate_if()instead. To mapfunsover a selection of variables, usemutate_at()mutate_each()is deprecated. Usemutate_all(),mutate_at()ormutate_if()instead. To mapfunsover a selection of variables, use `mutate_at
I tried mutate_at and mutate_all but no luck. 
Case1:
author_dist <-
  dist_df %>%
  mutate_at(vars(gsub("T.*","",.)),-distance) %>% 
  mutate_at(vars(ifelse(nchar(.)<3,gsub("A","A0",.),.)),-distance) %>% 
  group_by(Sentence1,Sentence2) %>% 
  summarise(avg_dist=mean(distance)) %>% 
Error: Strings must match column names. Unknown columns: c("A1, c(1, 1, 0.75, 1, 0.875, 1, 0, 0.8, 0.6, 1, 1, 0.875, 0.8, 0.857142857142857, 1, 1, 0.75, 1, 0.75, 1, 1, 0.8, 0.666666666666667, 1, 1, 0.888888888888889, 0.9, 1, 0.8, 1, 1, 1, 1, 0.666666666666667, 1, 0.75, 0.666666666666667, 0.666666666666667, 1, 0.75, 1, 0.666666666666667, 1, 1, 1, 1, 0.833333333333333, 1, 1, 0.75, 0.8, 1, 1, 1, 1, 0.5, 1, 0.666666666666667, 1, 1, 1, 0.8, 0.8, 1, 0.8, 1, 0.8, 1, 0.8, 1, 1, 0.8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.666666666666667, 1, 1, 1, 1, 1, 1, 0.833333333333333, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.75, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.666666666666667, 1, 1, 1, 1, 0.666666666666667, 1, 0.666666666666667, 1, 0.875, 0.75, 1, 1, 1, 1, 1, 0.857142857142857, 1, 0.333333333333333, 1, 1, 0.666666666666667, 1, 0.833333333333333, 1, 0.888888888888889, 1, 1, 0.75, 1, 1, 0.875, 1, 1, 1, 1, 0.8,
Case2:
author_dist <-
  dist_df %>%
  mutate_all(vars(gsub("T.*","",.)),-distance) %>% 
  mutate_all(vars(ifelse(nchar(.)<3,gsub("A","A0",.),.)),-distance) %>% 
  group_by(Sentence1,Sentence2) %>% 
  summarise(avg_dist=mean(distance)) %>% 
Error in eval_bare(dot$expr, dot$env) : object 'distance' not found
Sorry about my question I am a bit novice to statistics. Any ideas would be appreciated.
