I will build on this question Similar to Remove Rows From Data Frame where a Row match a String
For example:
A,B,org.id
4,3,Foo
2,3,Bar
2,4,Bar
7,5,Zap
7,4,Zap
7,3,Zap
How would I return a dataframe that excludes all rows where org.id is the same as the row above?
A,B,org.id
4,3,Foo
2,3,Bar
7,5,Zap
Guess: Perhaps melt() or cast() functions could do the trick. (I only know how to do this in excel, where I have to create a new dataframe and do IF[a2=a1,0,a2].)
The question is also similar to Subtract the previous row of data where the id is the same as the row above but that is in sql.