Questions tagged «indices»

12
在FUN中访问lapply索引名称
有没有办法在我的lapply()函数中获取列表索引名称? n = names(mylist) lapply(mylist, function(list.elem) { cat("What is the name of this list element?\n" }) 我之前询问过是否可以在返回的lapply()列表中保留索引名称,但是我仍然不知道是否有一种简单的方法来获取自定义函数中的每个元素名称。我想避免对名称本身调用lapply,我宁愿在函数参数中获取名称。
162 r  lapply  names  indices 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.