Data frame columns as arguments to dplyr functions
Suppose that you would like to create a function which does a series of computations on a data frame. You would like to pass a column as this function’s argument. Something like:
data(cars) convertToKmh <- function(dataset, col_name){ dataset$col_name <- dataset$speed * 1.609344 return(dataset) }This example is obviously not very interesting (you don’t need a function for this), but ... [Read more...]