1

I have this strange error popping up when defining my mlr Random Forest (regression) Task. I cannot find anything online about this type of error. The error is:

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'.

Does anyone have an idea about what this error means and/or suggestions on how to get around it?

Background info: My data is a tibble that looks like this:

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 ...

and I am trying to make a Random Forest (regression) model to predict logRR (response ratios).

Any help is very welcome. Thank you!

0 Answers0