I need to store the results of my loop in a data frame but i can't figure it out. I got the loop working as shown below.
Pasta_pesto <- list(ingredienten = c("spaghetti","basilicum","pijnboompitten","pesto"))
Broccoli_spinaziesoep <- list(ingredienten = c("broccoli", "spinazie"))
Romige_kipcurry <- list(ingredienten = c("zilvervliesrijst", "sperziebonen", "kip", "curry"))
recepten <- list(Pasta_pesto, Broccoli_spinaziesoep, Romige_kipcurry)
food_box <- list("spaghetti", "pesto", "kip", "curry")
for (i in recepten) {
for (e in i) {
for (j in e) {
for (k in food_box) {
if (k == j){
print(c("true", j, k))
}
else {
print(c("false", j, k))}}}}}
rights now its prints out true or false but the end result should be a table with the following columns: recepten, count of true per recept, total items in recept list. as you can see the amount of true's have to be count and stored.
I hope any of you can help me.