HN user

firstinstinct

21 karma
Posts0
Comments8
View on HN
No posts found.

at the end of the comments of the post http://varianceexplained.org/r/teach-tidyverse/

compare base R:

  var1 <- "pounds"
  var2 <- "wt"
  mtcars[[var1]] <- mtcars[[var2]]/1000
Now hadley solution comment: You can now express that sort of thing fairly elegantly with dplyr:
  var1 <- sym("pounds")
  var2 <- sym("wt")
  mtcars <- mutate(mtcars,!!var1 := !!var/100)

  
 Watch your steps: !!, :=, sym.

Thats a lot of added complexity to be able to use column names, and to top it all, the use of non standard evaluation make things very complex when one go a little away from basic EDA.