'R: How can I filter out a specific variable value from each table in my list of tables?

Suppose you had a list of 200 tables each containing the variable "cyl". In the variable "cyl", there are three values ("4", "6", and "8"). In R, how could I filter out the value "4" from each of the 200 tables?

The code for the list generation is provided below.

output <- list()

iterations <- 200

for(i in 1:iterations){
  output[[i]] <-  mtcars <- mtcars[sample(nrow(mtcars), size = 15, replace = FALSE), ]

}

Any help at all is greatly appreciated!

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source