grts() ssurvey error: dims [product 16] do not match the length of object [17]

问题描述 投票:0回答:0

我在 spsurvey 中使用 grts() 函数

unique(shape$strataFACT2)
 [1] "thirty-four"  "twenty-three" "thirty-three"
 [4] "twenty-four"  "twelve"       "thirty-two"  
 [7] "fourteen"     "thirty-one"   "twenty-two"  
[10] "twenty-one"   "forty-two"    "fifty-one"   
[13] "forty-one"    "fifty-two"    "thirteen"    
[16] "forty-three"  "fifty-four"  



caty_n=c("twelve"=1,"thirteen"=1,"fourteen"=1,
         "twenty-one"=1,"twenty-two"=1,"twenty-three"=3,
         "twenty-four"=2,
         "thirty-one"=2,"thirty-two"=2,"thirty-three"=4,
         "thirty-four"=2,
         "forty-one"=1,"forty-two"=1,"forty-three"=1,
         "fifty-one"=1,"fifty-two"=2,"fifty-four"=1)
length(caty_n)

sum(caty_n)


strat_propprob <- grts(shape2, 
                     n_base = sum(caty_n), 
                     caty_var = "strataFACT2",
                     caty_n=caty_n)

我现在已经在其他脚本中多次运行此代码,没有任何问题。但是,我现在收到错误消息:

Error in grtspts_ip(type = dsgn[["seltype"]][stratum], n_base = n_caty,  : 
  dims [product 16] do not match the length of object [17]
In addition: Warning message:
In n_base/gsum[catmatch] :
  longer object length is not a multiple of shorter object length

我不明白这个错误有什么关系,因为我的 caty_n 对象长度确实是 17.

我错过了什么?

r spatial
© www.soinside.com 2019 - 2024. All rights reserved.