I have a data frame with 3 variables: place, time, and value (P, T, X). I want to create a fourth variable which will be the cumulative sum of X. Normally I like to do grouping calculations with sqldf, but can't seem to find an equivalent for cumsum. That is:
sqldf("select P,T,X, cumsum(X) as X_CUM from df group by P,T") 
doesn't work. Is this even possible with sqldf? I tried doBy, but that doesn't all cumsum either.
 
     
     
     
    