r: how to remove row numbers coming from a separate list in multiple data frames using lapply <p>I have many data frames organized in a list object. And I have a second list of vectors, that contain row numbers that I want to remove in my data frames. The rows to be removed are different for each data frame. Therefore the number of elements in the list of data frames is equal to the number of elements in the list of vectors. Here the code I've tried out:</p> <pre><code>test_list&lt;-vector(mode="list",5) test_list&lt;-lapply(test_list, function(x) data.frame(1,1:10,"c")) vec_list&lt;-vector(mode="list",5) vec_list&lt;-lapply(vec_list, function (x) x&lt;-sample(seq(1,10),4)) clean_list&lt;-lapply(test_list, function (x,y) clean_list&lt;-x[-y,],vec_list) </code></pre>