Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Apparently spurious warning "[tapp] it is not sensible to a single value as index" #1887

@Kodiologist

Description

@Kodiologist
> library(terra)
terra 1.8.60
> r = c(rast(volcano), rast(volcano + 5))
> tapp(r, c(1L, 1L), "sum")
Warning: [tapp] it is not sensible to a single value as index (use app instead)
class       : SpatRaster 
size        : 87, 61, 1  (nrow, ncol, nlyr)
resolution  : 1, 1  (x, y)
extent      : 0, 61, 0, 87  (xmin, xmax, ymin, ymax)
coord. ref. :  
source(s)   : memory
name        :  X1 
min value   : 193 
max value   : 395

This is the expected result. There's no reason to use tapp if you know the vector of indices will always be constant, of course, but you can end up using a constant vector if it's computed from other code, and in this case the warning is just noise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions