我将csv格式面板数据导入rstudio后,想要应用cluster函数,但他一直报错 'list' object cannot be coerced to type 'double',想问一下怎么解决。下面是我的数据类型和报错代码。
spc_tbl_ [186 x 16] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
$ ID : num [1:186] 1 2 3 4 5 6 7 8 9 10 ...
$ YEAR: num [1:186] 2015 2016 2017 2018 2019 ...
$ PRO : chr [1:186] "北京" "北京" "北京" "北京" ...
$ A : num [1:186] 0 0 0 0 0 0 0 0 0 0 ...
$ S : num [1:186] 0.672 0.615 0.766 0.789 0.883 ...
$ P : num [1:186] 0 0 0 0 0 3 0 0 2 1 ...
$ F : num [1:186] 21587 23145 24748 26399 26561 ...
$ T : num [1:186] 0.856 0.912 0.813 0.888 1 ...
$ R : num [1:186] 24.6 25.3 27 26.7 31.4 ...
$ U : num [1:186] 2188 2195 2194 2192 2190 ...
$ S1 : num [1:186] 0.499 0.384 0.737 0.784 0.912 0.94 0.166 0.27 0.385 0.496 ...
$ P1 : num [1:186] 0.05 0.05 0.05 0.05 0.05 0.561 0.05 0.05 0.501 0.187 ...
$ F1 : num [1:186] 0.938 0.951 0.962 0.971 0.972 0.964 0.9 0.905 0.862 0.837 ...
$ T1 : num [1:186] 0.982 0.986 0.977 0.984 0.991 0.989 0.859 0.91 0.761 0.78 ...
$ R1 : num [1:186] 0.73 0.74 0.76 0.757 0.809 0.831 0.548 0.54 0.513 0.507 ...
$ U1 : num [1:186] 0.178 0.179 0.179 0.179 0.178 0.178 0.1 0.101 0.098 0.096 ...
P2<-cluster(performance,results = "P1",outcome="S1",unit_id = "PRO",cluster_id = "YEAR",necessity = TRUE)
Error in cluster(performance, results = "P1", outcome = "S1", unit_id = "PRO", :
'list' object cannot be coerced to type 'double'