I have a named list containing 4 tibbles:
list_all <- list("iris_a" = iris,
"iris_b" = iris,
"iris_c" = iris,
"iris_d" = iris)
Now I'd like to add for example the Petal.Length of the flower that has a Sepal.Length of 6.8 and Species == versicolor to the Petal.Length of the flower that has a Sepal.Length of 7.0 and Species == versicolor in every one of those four tibbles.
I can do this hardcoded with:
list_all[['iris_a']][51,3] <- list_all[['iris_a']][51,3] + list_all[['iris_a']][77,3]
list_all[['iris_b']][51,3] <- list_all[['iris_b']][51,3] + list_all[['iris_b']][77,3]
list_all[['iris_c']][51,3] <- list_all[['iris_c']][51,3] + list_all[['iris_c']][77,3]
list_all[['iris_d']][51,3] <- list_all[['iris_d']][51,3] + list_all[['iris_d']][77,3]
but trying to grab the value with something like
list_all[['iris_a']]['Sepal.Length' == 7.0 & 'Species' == 'versicolor', 'Petal.Width']
results in numeric(0).
I'm thankfull for any advice!