Re: [R] any and all

2024-04-13 Thread avi.e.gross
: Saturday, April 13, 2024 3:17 AM To: avi.e.gr...@gmail.com; murdoch.dun...@gmail.com; toth.de...@kogentum.hu; r-help@r-project.org Subject: Re: [R] any and all Hi Avi, As Dénes Tóth has rightly diagnosed, you are building an "all or nothing" filter. However, you do not need to explicitly

Re: [R] any and all

2024-04-13 Thread Lennart Kasserra
Hi Avi, As Dénes Tóth has rightly diagnosed, you are building an "all or nothing" filter. However, you do not need to explicitly spell out all columns that you want to filter for; the "tidy" way would be to use a helper function like `if_all()` or `if_any()`. Consider this example (I hope I

Re: [R] any and all

2024-04-12 Thread avi.e.gross
rom: Dénes Tóth Sent: Friday, April 12, 2024 6:43 PM To: Duncan Murdoch ; avi.e.gr...@gmail.com; r-help@r-project.org Subject: Re: [R] any and all Hi Avi, As Duncan already mentioned, a reproducible example would be helpful to assist you better. Having said that, I think you misunderstand how `dp

Re: [R] any and all

2024-04-12 Thread Dénes Tóth
Hi Avi, As Duncan already mentioned, a reproducible example would be helpful to assist you better. Having said that, I think you misunderstand how `dplyr::filter` works: it performs row-wise filtering, so the filtering expression shall return a logical vector of the same length as the data.fr

Re: [R] any and all

2024-04-12 Thread Duncan Murdoch
On 12/04/2024 3:52 p.m., avi.e.gr...@gmail.com wrote: Base R has generic functions called any() and all() that I am having trouble using. It works fine when I play with it in a base R context as in: all(any(TRUE, TRUE), any(TRUE, FALSE)) [1] TRUE all(any(TRUE, TRUE), any(FALSE, FALSE))

[R] any and all

2024-04-12 Thread avi.e.gross
Base R has generic functions called any() and all() that I am having trouble using. It works fine when I play with it in a base R context as in: > all(any(TRUE, TRUE), any(TRUE, FALSE)) [1] TRUE > all(any(TRUE, TRUE), any(FALSE, FALSE)) [1] FALSE But in a tidyverse/dplyr environment, it retur