Skip to content

sql to r – select cases

I have included a lot of sql code in R using the sqldf library. Since this is becoming increasingly hard to digest, I would like to do it using, for example dplyr in native R. How would I do it for …

Row comparison in table via SQL

I have a table which is structured like the following: Is there a way to build a SQL query which – per each ID – looks for the Day in which Value1 OR Value2 has changed? The result I would like to achieve would be this: In which I can keep track of those changes per ID per Day. Edit: