Displaying 1 result from an estimated 1 matches for "sydbank".
Did you mean:
nedbank
2009 Nov 19
5
Accessing list names in lapply
Hi,
When using lapply (or sapply) to loop over a list, can I somehow access the
index of the list from inside the function?
A trivial example:
df1 <- split(
x=rnorm(n=100, sd=seq(from=1, to=10, each=10)),
f=letters[seq(from=1, to=10, each=10)]
)
str(df1)
#List of 10
# $ a: num [1:10] -0.801 0.418 1.451 -0.554 -0.578 ...
# $ b: num [1:10] -2.464 0.279 4.099 -2.483 1.921 ...
# $ c: num