I am new to R and keep getting errors with the following message:
unable to find an inherited method for function ‘A’ for signature ‘\"B\"’
I have seen this message numerous times, as a result of namespace conflicts.
Here is a MRE: Both the hash and data.table libraries have copy functions.
In a new R session:
> library(data.table)
> library(hash)
causes copy from data.table to be masked:
> DT = data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9)
> copy(DT)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘copy’ for signature ‘"data.table"’
The solution is to specify the namespace:
> data.table::copy(DT)
x y v
1: b 1 1
2: b 3 2
3: b 6 3
4: a 1 4
5: a 3 5
6: a 6 6
7: c 1 7
8: c 3 8
9: c 6 9