f <- function(k) { seq_len(k) }
lapply(1:5,f)
## [[1]]
## [1] 1
## 
## [[2]]
## [1] 1 2
## 
## [[3]]
## [1] 1 2 3
## 
## [[4]]
## [1] 1 2 3 4
## 
## [[5]]
## [1] 1 2 3 4 5
unlist(lapply(1:5,f))
##  [1] 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5
# also look to vapply!
lapply(1:10,sin)
## [[1]]
## [1] 0.841471
## 
## [[2]]
## [1] 0.9092974
## 
## [[3]]
## [1] 0.14112
## 
## [[4]]
## [1] -0.7568025
## 
## [[5]]
## [1] -0.9589243
## 
## [[6]]
## [1] -0.2794155
## 
## [[7]]
## [1] 0.6569866
## 
## [[8]]
## [1] 0.9893582
## 
## [[9]]
## [1] 0.4121185
## 
## [[10]]
## [1] -0.5440211
vapply(1:10,sin,numeric(1))
##  [1]  0.8414710  0.9092974  0.1411200 -0.7568025 -0.9589243 -0.2794155
##  [7]  0.6569866  0.9893582  0.4121185 -0.5440211