makeRegrTask 中的错误:对“id”的断言失败:必须是“字符串”类型,而不是“tbl_df/tbl/data.frame”

问题描述

在定义我的 mlr 随机森林(回归)任务时出现这个奇怪的错误。我在网上找不到关于此类错误的任何信息。错误是:

era.af.Al_Task <- era.af.Al_Tib %>%
  makeRegrTask(data = era.af.Al_Tib,target = "logRR")

Error in makeRegrTask(.,data = era.af.Al_Tib,target = "logRR") : 
Assertion on 'id' Failed: Must be of type 'string',not 'tbl_df/tbl/data.frame'.

有没有人知道这个错误意味着什么和/或如何解决它的建议?

背景信息: 我的数据是一个看起来像这样的小标题

tibble[,34] [4,340 × 34] (S3: tbl_df/tbl/data.frame)
 $ ID                        : num [1:4340] 1689 1689 1689 1689 1689 ...
 $ PrName                    : chr [1:4340] "Agroforestry Pruning-Alleycropping-Boundary Planting" "Agroforestry Pruning-Alleycropping-Boundary Planting" "Agroforestry Pruning-Alleycropping-Boundary Planting" "Agroforestry Pruning-Alleycropping-Boundary Planting" ...
 $ SubPrName                 : chr [1:4340] "AgFor Alley (Nfix)-AgFor Prune (UnkNown)-AgFor Prune Mulch (Nfix)-Hedge" "AgFor Alley (Nfix)-AgFor Prune (UnkNown)-AgFor Prune Mulch (Nfix)-Hedge" "AgFor Alley (nonNfix)-AgFor Prune (UnkNown)-AgFor Prune Mulch (nonNfix)-Hedge" "AgFor Alley (Nfix)-AgFor Prune (UnkNown)-AgFor Prune Mulch (Nfix)-Hedge" ...
 $ RR_group                  : int [1:4340] 2 2 2 3 2 2 5 3 2 2 ...
 $ logRR                     : num [1:4340] -0.0576 -0.1588 -0.0429 0.1551 -0.1266 ...
 $ RR                        : num [1:4340] 0.944 0.853 0.958 1.168 0.881 ...
 $ Site.ID                   : chr [1:4340] "Kazaboua" "Kazaboua" "Kazaboua" "Kazaboua" ...
 $ Product                   : chr [1:4340] "Maize" "Maize" "Maize" "Maize" ...
 $ Site.Type                 : chr [1:4340] "Farm" "Farm" "Farm" "Farm" ...
 $ AEZ16simple               : chr [1:4340] "Warm.Subhumid" "Warm.Subhumid" "Warm.Subhumid" "Warm.Subhumid" ...
 $ Bio01_MT_Anu.Mean         : num [1:4340] 18.2 18.2 18.2 18.2 18.2 ...
 $ Bio02_MDR.Mean            : num [1:4340] 11.6 11.6 11.6 11.6 11.6 ...
 $ Bio03_Iso.Mean            : num [1:4340] 38.7 38.7 38.7 38.7 38.7 ...
 $ Bio07_TAR.Mean            : num [1:4340] 30.1 30.1 30.1 30.1 30.1 ...
 $ Bio12_Pecip_Anu.Mean      : num [1:4340] 467 467 467 467 467 ...
 $ Bio15_Precip_S.Mean       : num [1:4340] 47.4 47.4 47.4 47.4 47.4 ...
 $ Bio17_Precip_DryQ.Mean    : num [1:4340] 36.3 36.3 36.3 36.3 36.3 ...
 $ Mean_log.n_tot_ncs        : num [1:4340] 56.2 56.2 56.2 56.2 56.2 ...
 $ Mean_log.ca_mehlich3      : num [1:4340] 59.3 59.3 59.3 59.3 59.3 ...
 $ Mean_log.k_mehlich3       : num [1:4340] 41.4 41.4 41.4 41.4 41.4 ...
 $ Mean_log.mg_mehlich3      : num [1:4340] 45.1 45.1 45.1 45.1 45.1 ...
 $ Mean_log.p_mehlich3       : num [1:4340] 19.9 19.9 19.9 19.9 19.9 ...
 $ Texture_class_20cm_descrip: chr [1:4340] "Sandy_clay_loam" "Sandy_clay_loam" "Sandy_clay_loam" "Sandy_clay_loam" ...
 $ Mean_db_od                : num [1:4340] 129 129 129 129 129 ...
 $ Mean_bdr                  : num [1:4340] 200 200 200 200 200 200 200 200 200 200 ...
 $ Mean_sand_tot_psa         : num [1:4340] 55.8 55.8 55.8 55.8 55.8 ...
 $ Mean_silt_tot_psa         : num [1:4340] 17.3 17.3 17.3 17.3 17.3 ...
 $ Mean_clay_tot_psa         : num [1:4340] 21.6 21.6 21.6 21.6 21.6 ...
 $ Mean_ph_h2o               : num [1:4340] 58.7 58.7 58.7 58.7 58.7 ...
 $ Mean_log.ecec.f           : num [1:4340] 21.5 21.5 21.5 21.5 21.5 ...
 $ Mean_log.c_tot            : num [1:4340] 27.8 27.8 27.8 27.8 27.8 ...
 $ Mean_log.oc               : num [1:4340] 17.1 17.1 17.1 17.1 17.1 ...
 $ Elevation                 : num [1:4340] 300 300 300 300 300 300 NA NA NA NA ...
 $ Slope.mean                : num [1:4340] 1.77 1.77 1.77 1.77 1.77 1.77 2.58 2.58 2.58 2.58 ...

我正在尝试制作一个随机森林(回归)模型来预测 logRR(响应比)。

非常欢迎任何帮助。谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)