Search code examples
rpackagespatialcran

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?


Solution

  • > 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.