简体   繁体   中英

Extract attributes from R list

I fear I'm missing something obvious but . . . I have a list in R with structure

List of 752
 $ : Named chr "金銀"
  ..- attr(*, "names")= chr "名詞"
 $ : Named chr "吹替"
  ..- attr(*, "names")= chr "名詞"
 $ : Named chr "献言"

It's easy enough to get the top level of the list with unlist(my_object). But how can I capture the attributes? I can use unlist(attributes(my_object[[n]])) for each element n. But surely there's a quick way to get this into a data frame. What am I missing?

lapply(yourlist, attributes)

attributes函数应用于列表中的每个元素

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM