Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R Package Warning: multiple methods tables found for 'direction'

I am maintaining an R package for spatial data. When I run checks on R-devel (Windows), I get: "Warning: multiple methods tables found for 'direction'", which prohibits me from resubmitting my R package. I've checked and there is only one function direction() which is from the raster package - a package I don't explicitly import, but is suggested in sf which I do. Any ideas of what this could be/a workaround?

like image 308
mkamenet3 Avatar asked Oct 24 '25 03:10

mkamenet3


1 Answers

> library(sp)
> library(raster)
Warning messages:
1: multiple methods tables found for 'direction' 
2: multiple methods tables found for 'gridDistance' 

New session:

> raster::direction
standardGeneric for "direction" defined from package "raster"

function (x, ...) 
standardGeneric("direction")
<bytecode: 0x8163a60>
<environment: 0x81349e0>
Methods may be defined for arguments: x
Use  showMethods(direction)  for currently available ones.
Warning messages:
1: multiple methods tables found for 'direction' 
2: multiple methods tables found for 'gridDistance' 
> terra::direction
standardGeneric for "direction" defined from package "terra"

function (x, ...) 
standardGeneric("direction")
<bytecode: 0x312a030>
<environment: 0x30e2640>
Methods may be defined for arguments: x
Use  showMethods(direction)  for currently available ones.

It looks as though both raster and terra define these generics, terra 1.5-12 was just published. Resolution: https://github.com/rspatial/terra/issues/485#issuecomment-1012466626, re-install raster after terra.

like image 163
Roger Bivand Avatar answered Oct 25 '25 16:10

Roger Bivand



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!