I have a little question about using functions. For example, I have:
l <- list(a = data.frame(A1=rep(10,5),B1=c(1,1,1,2,2),C1=c(5,10,20,7,30)),
b = data.frame(A1=rep(20,5),B1=c(3,3,4,4,4),C1=c(3,5,10,20,30)))
I want to find a minimum of C1 for each B1. The result should be
$a
A1 B1 C1
10 1 5
10 2 7
$b
A1 B1 C1
20 3 3
20 4 10
I know how to do this with the "for", but it should be a simpler way with "lapply", but I could not get it to work.
Please, help
source
share