Here is an R tip. Need to quote a lot of names at once? Use qc()
.
This is particularly useful in selecting columns from data.frame
s:
library("wrapr") # get qc() definition head(mtcars[, qc(mpg, cyl, wt)]) # mpg cyl wt # Mazda RX4 21.0 6 2.620 # Mazda RX4 Wag 21.0 6 2.875 # Datsun 710 22.8 4 2.320 # Hornet 4 Drive 21.4 6 3.215 # Hornet Sportabout 18.7 8 3.440 # Valiant 18.1 6 3.460
Or even to install many packages at once:
install.packages(qc(vtreat, cdata, WVPlots)) # shorter than the alternative: # install.packages(c("vtreat", "cdata", "WVPlots"))
Categories: Coding
jmount
Data Scientist and trainer at Win Vector LLC. One of the authors of Practical Data Science with R.
A thank you to Ben Teusch for pointing out the similar abilities of
Hmisc::Cs()
. It is good to have alternatives.