Quantcast
Viewing all articles
Browse latest Browse all 205343

`dplyr::filter` in `mapply`

For the following code I am expecting the same result as for dplyr::filter( tab, A < 3 )

tab <- data.frame( A = 1:3, B = letters[1:3] )
mapply( dplyr::filter, .data = list(tab), list( quote(A < 3) ), SIMPLIFY = FALSE  )

However, an error is raised:

Error: Evaluation error: could not find function "<".

On the other hand, this code works perfectly:

mapply( dplyr::filter, .data = list(tab), MoreArgs = list( quote(A < 3) ), SIMPLIFY = FALSE )

What is the source of the error?


Viewing all articles
Browse latest Browse all 205343

Trending Articles