r中的extactExtractr,错误:[名称< - ]名称的数量不正确
使用 eckectextractr package(cran link) 它一直在起作用:我有一个耙子堆栈(s)并用这样的形状文件(Inv)剪切,
df1 <- exact_extract(s, INV, fun = c("mean", "min", "max", "median", "variance"), append_cols = c("FLIK"))
但是从今天开始,我就会有一个错误消息
错误:[名称&lt; - ]名称的数量不正确
当我列出名称名称>名称
>或名称>名称(Inv)
的名称时,名称的数量不正确。我看不到任何错误。
我看不到任何隐藏的名字吗?有名字的障碍吗?
Used exactextractr package (CRAN link) already and it always worked : I have a raster stack (s) and cut out with a shape-file (INV) like this
df1 <- exact_extract(s, INV, fun = c("mean", "min", "max", "median", "variance"), append_cols = c("FLIK"))
But as from today I have an error message constantly like
Error: [names<-] incorrect number of names
When I list names either of names(s)
or names(INV)
I cannot see any mistake.
Are there any hidden names I cannot see ? Is there alimit of names ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我今天遇到了同样的问题,我设法以简单的方式修复了我的代码。当我读取栅格文件(.nc)时,我从
raster
库中使用了stack
函数。此代码Ruturn是一个栅格扇形对象。下面的代码给了我与您提到的相同的错误。我设法通过使用
brick
函数(从同一库中)返回rasterbrick来解决此问题。这样,我可以在没有错误的情况下运行代码,如下所示:我不完全知道这里发生了什么,因为我过去曾经使用
stack
函数,这根本没有问题。由于某种原因,使用Brick
这次修复了我的代码。我希望这可以帮助您。I had the same problem today and I manage to fix my code in a simple way. When I read the raster file (.nc), I used the
stack
function fromraster
library. This code ruturns a RasterStack object. The code below gave me the same error as you mentioned.I managed to fix that by using the
brick
function, from the same library, that returns a RasterBrick. That way, I could run my code without errors, as following:I don't exactly knows what is happening here, because I have used the
stack
function in the past with no problem at all. For some reason, usingbrick
fixed my code this time. I hope this can help you.事实是,TIFF中有多个层/频道。首先,您必须将其减少到一层,然后给出正确的名称数。
It was about the fact, that there are more than one layers/channels in a tiff. First you have to reduce to one layer, then it gives the correct number of names.