Я новичок в R и имею эту проблему:
Ошибка в if (type == "xls") {: пропущенное значение там, где требуется TRUE / FALSE
У меня есть этот код, и я не знаю, в чем проблема:
for (i in 1:length(data))
{
setwd("D:\\Baltoro\\Landsat_2017\\Shape_area")
Shape = shapefile(data[i])
filename = file[i]
for (ii in 1:14)
{
area = shapefile(name_area[ii])
trans = spTransform(area, CRS("+proj=utm +zone=43 +ellps=WGS84"))
Shape1 = crop(Shape,trans)
name = sapply(filename, FUN=function(k) paste0(k, "_", ii, ".xlsx"))
if (is.na(Shape1))
{
print(name)
print("empty")
}
else
{
Shape1$area_sqm = area(Shape1)
Table = Shape1$area_sqm
setwd("D:\\Baltoro\\Auswertung\\Detail_2017")
write.xlsx(Table, file=name[i])
print(name)
print("done")
}
}
}