Relative Content

Tag Archive for rfor-loopdplyrdata.tablepurrr

Shifting values up rows in a dataframe in R by group

I have a dataframe in R where I need to shift the values up in a particular column using a numeric value. The numeric value which is used as input to shift the values up are associated with a grouping variable and are often different from group to group. Here is an example of a mock dataframe