Reproducible code / data always helps:
L1 <- list(a = c(3.4, 5.6, -2.1, -7.8), b = c(2.1, 6.7), c = c(-6.7, 0.001, 8.9))
Use lapplyto apply your own function to each element, which.maxit easily finds the maximum, and we get only olta absin each of them:
lapply(L1, function(x) x[which.max(abs(x))])
$a
[1] -7.8
$b
[1] 6.7
$c
[1] 8.9
source
share