Skip to content
Advertisement

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 the following:

Advertisement

Answer

Maybe something like this in dplyr:

Or base R:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement