In R write list with several elements to data.frame

后端 未结 4 359
自闭症患者
自闭症患者 2021-01-29 05:51

I have a named list whose each element is a character vector. I want to write this list into a single dataframe where I have two columns, one with the name of the character vect

4条回答
  •  梦毁少年i
    2021-01-29 06:06

    Maybe

    data.frame(vecname = rep(names(ll), sapply(ll, length)), chars = unlist(ll))
    

    to have each element of each list component correspond to a row in the final dataframe.

提交回复
热议问题