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

问题


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

标签

更多相关内容:请点击查看