See my updated code. I forgot to change the x
to .
. For future reference, it's helpful if you provide a reproducible example so that we can run your code and test out solutions.
A couple of additional notes: (1) While vars(2:12)
works in this case, it's brittle, because it will fail if the order of your columns changes. If there's some regularity to the column names, you can use other column selection methods that will be more robust. (2) mutate_at
will continue to work, but the latest version of dplyr
has new capabilities that allow you to use mutate
whether you're working on one column or multiple columns. see the vignette for details.