悬赏 5 个论坛币 未解决
# get the mdat for tmp from 2004 to 2015
tmp0 = tmp[, , (1+12*(yrlb-nyrs[1])):(12+12*(yrub-nyrs[1]))]
dim(tmp0)
# "Juicy part", get the data for location in "ll"
dmattmp = matrix(0, nloc, ny*12)
nloc; ny
for (i in 1:nloc) {
dmattmp[i, ] = tmp0[lontmp == ll[i, 2], lattmp == ll[i, 1], ]
}
Error in dmattmp[i, ] <- tmp0[lontmp == ll[i, 2], lattmp == ll[i, 1], :
更换参数长度为零
dim(dmattmp) # 687 144
# "dmattmp" is a matrix of nloc*(12ny)
sum(is.na(dmattmp))/144 # 17 locations with missing values
在运行上述代码是出现上述问题,求各位大神指教,应该怎么修改?