Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘select’ for signature ‘“spec_tbl_df”’

邮差的信 提交于 2020-06-16 16:55:06

问题


I am having this error code appear on in my project.

the strange thing is, the piece of code I am using was working perfectly earlier today. However, since I installed an update for R I am now getting this message when running it.

df1 <- df %>% select(Month, Longitude, Latitude, Type)

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘select’ for signature ‘"spec_tbl_df"’

The code was used simply to create a new data frame with only the selected columns.

Any help would be greatly appreciated!


回答1:


A new version of R has recently been released: 4.0.0.

There has been some major changes, see here for a list. The documentation says that this might have broken some methods that were based on R 3.6.* behavior. Maybe the method for the class spec_tbl_df was relying on something that changed.

That's a clue more than a definitive answer, maybe some users will give you a better one

Update

Given the issue here, it looks like there exists a conflict between the base R select method and dplyr::select method for objects of class spec_tbl_df. In that case, the easiest solution is to ensure you use dplyr namespace by using the dplyr::select syntax.



来源:https://stackoverflow.com/questions/61428168/error-in-function-classes-fdef-mtable-unable-to-find-an-inherited-method

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!