loading dplyr after plyr is causing issues

后端 未结 2 1729
难免孤独
难免孤独 2020-12-18 11:11

Test Case:

library(dplyr)
library(plyr)
library(dplyr)
mtcars%>%rename(x=gear)

This gives error. Any help would be greatly appreciated.

相关标签:
2条回答
  • 2020-12-18 11:24

    I have this problem when require plyr again sourcing files. You can do

    if("dplyr" %in% (.packages())){
              detach("package:dplyr", unload=TRUE) 
              detach("package:plyr", unload=TRUE) 
    } 
    library(plyr)
    library(dplyr)
    
    0 讨论(0)
  • 2020-12-18 11:28

    Based on @hadley's tweet. Best answer is to load plyr ALWAYS before dplyr, AND not load plyr again. Pasting his tweet for reference.


    Hadley Wickham ‏@hadleywickham  Jul 27
    @gunapemmaraju just load plyr before dplyr?
    
    0 讨论(0)
提交回复
热议问题