I want to fetch some values out of a list of data frames and save the results in a new data frame. This is how my code looks:
for (i in 1:length(covpatient)){
a <- names(covpatient[i])
b <- sum(covpatient[[i]]$cov == 0)
c <- sum(covpatient[[i]]$cov > 0 & covpatient[[i]]$cov <= 40)
d <- sum(covpatient[[i]]$cov > 40 & covpatient[[i]]$cov <= 100)
e <- sum(covpatient[[i]]$cov > 100)
summary <- c(a,b,c,d,e)
}
So for every dataframe in the list covpatient, I want to create a summary variable which consists of 5 elements (a,b,c,d,e). Then I want to make a new data.frame which stores all summary values (5 columns & i rows).
Could someone give me a hand?