You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just wonder whether perhaps one could make dplyr verbs to act more like base R and propagate NULL data frames instead of throwing an error. Here is a simple example:
# Assume you sometimes have no data# and df is NULLdf=NULL# Base R does not throw errors quickly# but conveniently propagates NULLdf[df$a==1,]
## NULL# dplyr verbs are not as tolerant...
filter(df, a==1)
## Error in UseMethod("filter_") : ## no applicable method for 'filter_' applied to an object of class "NULL"
Returning NULL instead of an error could probably be easily implemented by adding functions like:
filter_.NULL=function(...) return(NULL)
While this is not a big issue, I would find NULL propagation quite convenient, since one can get rid of some case distinctions and dplyr would probably behave more like base R.
Conceptually it also seems sound to me to return NULL:
If I filter something from NULL, it seems intuitive that the result is NULL.
If I arrange NULL the result should also be NULL.
If I mutate NULL the result should also be NULL.
... and so on...
The text was updated successfully, but these errors were encountered:
I just wonder whether perhaps one could make dplyr verbs to act more like base R and propagate NULL data frames instead of throwing an error. Here is a simple example:
Returning NULL instead of an error could probably be easily implemented by adding functions like:
While this is not a big issue, I would find NULL propagation quite convenient, since one can get rid of some case distinctions and dplyr would probably behave more like base R.
Conceptually it also seems sound to me to return NULL:
If I filter something from NULL, it seems intuitive that the result is NULL.
If I arrange NULL the result should also be NULL.
If I mutate NULL the result should also be NULL.
... and so on...
The text was updated successfully, but these errors were encountered: