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

2

7

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!

Outlawry answered 25/4, 2020 at 15:36 Comment(7)
What is the new version of R you have ? version command can be runAtony
Hi there linog, Im now running version 4.0.0. I updated it because R markdown was not running. Now Rmarkdown works but my code does not.Outlawry
Ok this can come from the R 4.0.0 update. Or maybe it comes from that. Did you try writing dplyr::select rather than select ?Atony
That worked! Thank you so much!Outlawry
If you submit an answer I will accept it linogOutlawry
Cool ! I edited my previous answer to put this solutionAtony
Does this answer your question? Unable to find an inherited method for function ‘select’ for signature ‘"data.frame"’Logger
A
16

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.

Atony answered 25/4, 2020 at 16:9 Comment(0)
S
0

I have forgot add dbDriver("PostgreSQL") in my case. This will help maybe )

db_con = dbConnect(
    **dbDriver("PostgreSQL")**, 
    user='****',
    password='****',
    dbname='****',
    host='****',
    port='****'
  )
Seesaw answered 20/2, 2021 at 8:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.