我正在尝试动态操作列表。有两个列表
List structure:#List 1: file.cuisine.table
$ :List of 3
..$ id : num 8753
..$ cuisine : chr "italian"
..$ ingredients: chr [1:6] "olive oil" "olives" "salt" "blood orange" ...
[list output truncated]
$ :List of 3 #List 2: unique.ing.list # ingredient list
..$ : chr "ground turkey"
..$ is.present.cuisine: chr [1:3] "chinese" "mexican" "italian"
..$ is.present.recipe : num [1:5] 45887 41995 49136 10276 8820
[list output truncated]
我正在尝试将地图成分转换为美食。行代码
cuisine.new <- "mexican" #(new recipe discovered while traversing the table file.cuisine.table )
temp.cuisine <- unique.ing.list[[1]][["is.present.cuisine"]]
temp.recepie <- unique.ing.list[[1]][["is.present.recipe"]]
temp.cuisine[length(temp.cuisine)+1] <- cuisine.new
unique.ing.list[[pos]][["is.present.cuisine"]] <- temp.cuisine
error: Error in unique.ing.list[[pos]][["is.present.cuisine"]] <- temp.cuisine : more elements supplied than there are to replace
这些行代码在遍历&#34; file.cuisine.table&#34;时会中断。因此我不知道如何调试。任何线索。