[英]How can I filter out specific rows in tables in R loaded from an HTML file?
[英]R: How can I filter out a specific variable value from each table in my list of tables?
假設您有一個包含 200 個表的列表,每個表都包含變量“cyl”。 在變量“cyl”中,有三個值(“4”、“6”和“8”)。 在 R 中,如何從 200 個表中過濾掉值“4”?
下面提供了列表生成的代碼。
output <- list()
iterations <- 200
for(i in 1:iterations){
output[[i]] <- mtcars <- mtcars[sample(nrow(mtcars), size = 15, replace = FALSE), ]
}
非常感謝任何幫助!
把我的評論變成一個答案,如果你有一個你想應用於項目列表的操作, lapply
通常是正確的選擇:
lapply(output, subset, cyl != 4)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.