inbo / watina

R package for querying & processing data from the INBO Watina database (groundwater data)
https://inbo.github.io/watina/
GNU General Public License v3.0
1 stars 0 forks source link

Do not arrange() lazy objects within functions (unless always collected immediately after) #74

Closed florisvdh closed 3 years ago

florisvdh commented 3 years ago

This fixes #63.

The functions get_locs(), get_xg3() and get_chem() now don't sort a lazy result anymore, because otherwise, when using the result inside another lazy query, this led to ORDER BY constructs in SQL subqueries, which must be avoided. Such cases throw a warning since dbplyr 2.0.0, and it appears to be prohibited by MS SQL.

Only with collect = TRUE, the sorting is still automatically taken care of by these functions.

If you like to print a resulting lazy object in a sorted manner, you must add %>% arrange(...) yourself.

Function documentation: examples in which lazy objects were printed, have been sorted accordingly. Vignettes will be dealt with in a separate PR.