You can also want to use a function with two arguments: name and item. In this case mapply() is your friend: score <- list(name1 = 1, name2 = 2) res <- mapply(names(score), score, FUN=function(nm, it) it*nchar(nm))
score <- list(name1 = 1, name2 = 2)
res <- mapply(names(score), score, FUN=function(nm, it) it*nchar(nm))