You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unlike raster::layerStats() with stat='pearson', terra::layerCor() with fun='pearson' does not include the layer names in the result, although it does if fun='weighted.cov':
library(terra)
b <- rast(system.file("ex/logo.tif", package="terra"))
w <- init(b, fun="col")
layerCor(b, "pearson", w=w)
# $pearson
# [,1] [,2] [,3]
# [1,] 1.0000000 0.9980961 0.9501633
# [2,] 0.9980961 1.0000000 0.9658011
# [3,] 0.9501633 0.9658011 1.0000000
#
# $mean
# [,1] [,2] [,3]
# [1,] NaN 182.2855 182.2855
# [2,] 185.3509 NaN 185.3509
# [3,] 192.8046 192.8046 NaN
layerCor(b, "weighted.cov", w=w)
# $weighted_covariance
# red green blue
# red 5670.750 5536.351 5009.851
# green 5536.351 5427.161 4987.092
# blue 5009.851 4987.092 4937.007
#
# $weighted_mean
# red green blue
# 177.5983 181.3521 191.5236
It'd be great if layer names were included for 'pearson' too. Cheers!
The text was updated successfully, but these errors were encountered:
layerCor(b, "pearson", w=w)
#$pearson
# 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
Unlike
raster::layerStats()
withstat='pearson'
,terra::layerCor()
withfun='pearson'
does not include the layer names in the result, although it does iffun='weighted.cov'
:It'd be great if layer names were included for 'pearson' too. Cheers!
The text was updated successfully, but these errors were encountered: