How can I use variable names to refer to data frame columns with ddply?
问题 I am trying to write a function that takes as arguments the name of a data frame holding time series data and the name of a column in that data frame. The function performs various manipulations on that data, one of which is adding a running total for each year in a column. I am using plyr. When I use the name of the column directly with ddply and cumsum I have no problems: require(plyr) df <- data.frame(date = seq(as.Date("2007/1/1"), by = "month", length.out = 60), sales = runif(60, min =