Apply subset function to a list of dataframes
问题 I have a list of SpatialPolygonDataFrame that I can assimilate to dataframe like this: df.1 <- data.frame(A = c(1:10), B = c(1, 2, 2, 2, 5:10)) df.2 <- data.frame(A = c(1:10), B = c(1, 2, 2, 2, 2, 2, 7:10)) df.3 <- data.frame(A = c(1:10), B = c(1, 2, 2, 4:10)) list.df <- list(df.1, df.2, df.3) I would like to get a list of a subset of each dataframe based on condition ( list.df.sub is the result I am looking for): df.1.sub <- subset(df.1, df.1$B != 2) df.2.sub <- subset(df.2, df.2$B != 2) df