I was analyzing data in a R Markdown file named as "A", and suddenly the group_by() function from dplyr package didn't work as expected anymore. Then I found out the similar problem has been addressed here: Why are my dplyr group_by & summarize not working properly? (name-collision with plyr). The solution is to detach the plyr package.
However, when I tried detach(package:plyr)
, I got an error message:"Error: package ‘plyr’ is required by ‘Rmisc’ so will not be detached". I was not using "Rmisc" in my current file "A", but "Rmisc" was used by another R Markdown file named as "B" which was also opened.
I finally had to use dplyr::group_by() to solve the problem. And actually I had to put dplyr:: to all the functions I tried to use such as mutate() and select(). This was really annoying!
So, my question is, in Rstudio, how to isolate the installed packages such as "Rmisc" to just a specific file such as "B" where it was needed, while the other files, such as "A" would not be affected? Thanks!
I would greatly appreciate your kind help!
Jeff