Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layerCor error #1387

Closed
Nowosad opened this issue Dec 27, 2023 · 1 comment
Closed

layerCor error #1387

Nowosad opened this issue Dec 27, 2023 · 1 comment

Comments

@Nowosad
Copy link
Contributor

Nowosad commented Dec 27, 2023

layerCor(b, fun = cor) had worked in the past, but does not anymore:

library(terra)
#> terra 1.7.67
b <- rast(system.file("ex/logo.tif", package="terra"))   

# works
layerCor(b, "pearson")
#> $correlation
#>             red     green      blue
#> red   1.0000000 0.9980961 0.9501633
#> green 0.9980961 1.0000000 0.9658011
#> blue  0.9501633 0.9658011 1.0000000
#> 
#> $mean
#>            red    green     blue
#> red        NaN 182.2855 182.2855
#> green 185.3509      NaN 185.3509
#> blue  192.8046 192.8046      NaN
#> 
#> $n
#>        red green blue
#> red    NaN  7777 7777
#> green 7777   NaN 7777
#> blue  7777  7777  NaN

# fails (but worked in the past versions)
layerCor(b, fun = cor)
#> Error: object 'mat' not found
@rhijmans
Copy link
Member

rhijmans commented Dec 27, 2023

Thanks, the internal version,

layerCor(b, "cor") 

worked but layerCor did not work anymore with custom R functions. It now works again

layerCor(b, cor) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants