R: subset a different set of rows (based on index) from each dataframe in a list using lapply/mapply or tidyverse
I have a list of 40 dataframes. Each dataframe in the list has the same variables but different number of observations. I would like to cut out some of the early rows and late rows of each dataframe, but it will be a different number of rows that are cut for each, which I will have as vectors of the row indices. That is, I would like to subset from row X to row Y in each dataframe: say, leave me with row 5 to 20 in the first datafrane, row 7 to 12 in the second dataframe, and row 1 to 18 in the third dataframe, etc.