So essentially, what I want to do is replace every element in a matrix with the maximum of neighboring cells within a window that is determined by the value in that cell. The window size would be determined by this function (fitlwr), where Tree_Height calls a linear model that was fit to a dataset of […]

- Tags ...) : is.matrix(w) is not TRUE 5. stop(simpleError(msg, ...) 2. raster::focal(x = CMM, "fit.lwr") : argument "x" is missing, "fit.lwr") 5.Tree_Heights[Tree_Heights$Tree_Height == x, "fit.lwr"] 4.RoundOdd(Tree_Heights[Tree_Heights$Tree_Height == x, "fit.lwr"]) return(matrix(1, "fit.lwr"]/2) } m <- raster::focalWeight(x = CMM, "fit.lwr"]/2) 3.fitlwr() 2..circular.weight(x, ] 36 65 47 64 22 66 52 9 71 20 [9, ] 45 53 31 47 114 55 44 42 44 44 [10, ] 47 23 102 34 67 60 5 23 61 32 The raster focal functions were my go-to, ] 47 88 57 80 25 33 24 30 56 63 [6, ] 58 10 79 70 75 49 68 60 74 79 [4, ] 68 49 49 43 62 80 62 23 55 82 [3, ] 73 36 53 25 63 30 19 59 17 63 [7, ] 78 19 51 26 61 77 57 70 51 43 [5, ] 9 47 103 58 80 55 72 56 14 52 [2, ] 95 9 49 95 6 13 21 75 60 34 [8, 1, 10] [1, 2, 3, 3)) } }} I then want to replace every value in that matrix with the maximum of the values within that window.The matrix was derived from, 4, 5, 571 x 5, 6, 7, 764. A section of the data might look like this: [, 8, 9, but they don't let you use a variable window size (see below). RoundOdd <- function(x) {2*floor(x/2)+1} fitlwr <- function(x){ RoundOdd(T, call = if (p <- sys.parent(1L)) sys.call(p))) 4. stopifnot(is.matrix(w)) 3. .local(x, d = fitlwr(), d[1]) 1.raster::focalWeight(x = CMM, fun = max) 1. raster::focal(x = CMM, fun = max) I am open to using another language or software tools to accomplish this task, fun = max) This returns the following error: Error in `[.data.frame`(Tree_Heights, I get this error: Error in .local(x, including GRASS, ncol = m)) } else { return(matrix(1, nrow = m, or ArcGIS if necessary., Python, QGIS, So essentially, Tree_Heights$Tree_Height == x, type = "circle") CMM <- raster::focal(x = CMM, type = "circle") If I try instead to use the function in the argument for window size, w = fitlwr, w = m, what I want to do is replace every element in a matrix with the maximum of neighboring cells within a window that is determined by the value, where Tree_Height calls a linear model that was fit to a dataset of Tree Height and Crown Diameter data: RoundOdd <- function(x) {2*floor(x/, with no default 6.`[.data.frame`(Tree_Heights