dplyr::filter freezes RStudio


I've been encountering a strange issue with dplyr::filter.

RStudio freezes when I try to execute code like that shown below...

people <- data.frame(age = c(12, 40, 9, 37, 88, 24, 71, 19),
                     fav_colour = c("green", "red", "blue", "red", "orange", "yellow", "purple", "blue"),
                     fav_food = c("pizza", "burger", "chocolate", "pie", "pineapple", "pizza", "burrito","pie"),
                     num_siblings = c(1, 1, 0, 4, 0, 2, 1, 3))
rownames(people) <- paste("Person", rownames(people), sep = "_")

people2 <- people %>% filter(num_siblings == 1)

When I try to execute the filtering part of the code above (where the data frame people2 is being created) RStudio freezes and can only be closed in task manager.
The weird part is I don't even have to hit enter, just typing this, for example...

people2 <- people %>% filter()

...causes RStudio to freeze.

The other frustrating thing is that this doesn't always happen. It can work fine for a while and then just stop working. I've tried loading and unloading different packages but this doesn't seem to have an effect on the frequency of this bug. There doesn't seem to be any rhyme or reason to it.

I've tried uninstalling and reinstalling dplyr and Rcpp but this hasn't helped.

This is my R version information:

> version
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
major          3                           
minor          5.2                         
year           2018                        
month          12                          
day            20                          
svn rev        75870                       
language       R                           
version.string R version 3.5.2 (2018-12-20)
nickname       Eggshell Igloo  

My RStudio version is 1.1.463.

Any help would be appreciated.

Thank you!

1 Like

This is definitely something specific to your setup. I've just run it with no problems.

Maybe try updating R and RStudio? Current R version is 3.6.0 and RStudio recently updated to 1.2.xxxx series.

1 Like

Thanks for your reply!

Incidentally, using dplyr::filter() instead of just filter() appears to fix the problem, suggesting it might be a function name conflict between packages?

I'll try updating R and RStudio, though.

It almost certainly an issue with the conflicting namespaces. You are probably using stats::filter and it breaks somehow. However, I've tried your code with it and it just returns an error about num_siblings not being found, so not sure what exactly is the issue.

1 Like

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