dplyr filter_if breaks with large tibble

Hi,

This is the same issue i posted here

I have a big tibble having 7000 rows and 10000 columns. I want to filter row if it has at least one non zero element across all columns. I wrote the following code which works fine on small tibble. As soon as I increases number of columns it breaks

Can anyone tell where is the glitch ?

Here, logic is not the issue. However, the problem is weird behaviour of filter_if
Thanks.

library(tidyverse)
ncol = 10000
nrow = 7000

rr = sample(c(0,1) , nrow * ncol , replace = TRUE) %>% 
  matrix(ncol = ncol) %>% 
  as.data.frame() %>% 
  as_tibble()

rr %>% dplyr::filter_if(is.numeric , .vars_predicate = any_vars(. != 0 ))
#> Error: evaluation nested too deeply: infinite recursion / options(expressions=)?

Created on 2019-07-19 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.