首页 > 解决方案 > 创建直方图“无效的'中断'数量”时R中的错误

问题描述

R 和 RStudio 相对较新,需要为我的遥感项目测试一个假设。一些背景知识:测试刚果盆地 2 个不同保护区的森林损失坡度,因此也在 ArcMap 中做一些工作。当使用一些代码时(见下文),其中一个区域的直方图看起来很好,但是当为另一个区域创建直方图时,R 会弹出“无效的'breaks'数量”错误。我似乎无法弄清楚,所以任何帮助或建议表示赞赏。谢谢!

我正在使用的代码是这样的:

# Open the .tif file for each protected area's forest loss once you specify 
# the filename correctly
tifSankuruNR<-raster("..." )
tifVirungaNP<-raster("...")

# Extract just the numeric values from the rasters
valuesSankuruNR<-values(tifSankuruNR) 
valuesVirungaNP<-values(tifVirungaNP) 

# Create a histogram of the values in the rasters
hist(valuesSankuruNR)
hist(valuesVirungaNP)

Sankuru 和 Virunga 是我正在调查的两个保护区,NR = 自然保护区,而 NP = 国家公园

**Edit**
**tifSankuruNR<-raster("SankuruForestLoss.tif")**

**tifVirungaNP<-raster("VirungaForestLoss.tif")**

标签: r

解决方案


推荐阅读