Suppose I have a list of tables. One of the columns of each of the tables is named and contains a count of NA values. For example, object 'e' in the below example shows a frequency of 2 in its last column:
a <- seq(1:5)
b <- c(NA,1,2,4,NA)
c <- a %>% data.frame(.,b)
d <- table(c[1], useNA = "always")
e <- table(c[2], useNA = "always")
f <- list(d, e)
Is there a way to order the elements in the list based on the number of NAs in the NA column found in each table in the list? For example, in list f in the above, the NA column in element [1] (i.e. table d) indicates 0 NAs and the NA column in element [2] (i.e. table e) indicates 2 NAs. Since 2 > 0 an I would like to sort the elements of the list from most NAs to least NAs, the list would be reordered to list(e,d).