r - Making a cumsum created vector correspond to the data from which it was created. -
i using cumsum
calculate accumulation of thermal units (tu). each day has multiple thermal units, end vector has length of on 3000, want column in dataframe tells me how many accumulated thermal units have each day. here example dataframe:
doy tu 1 5 2 10 3 5 4 5 5 10 6 5
and want like:
doy tu cumtu 1 5 5 2 10 15 3 5 20 4 5 25 5 10 35 6 5 40
i have been using cumsum(df$tu)
, not sure how use cumsum
in context of df.
Comments
Post a Comment