Combine frequency tables into a single data frame

前端 未结 3 1803
悲哀的现实
悲哀的现实 2021-02-04 19:08

I have a list in which each list item is a word frequency table derived from using \"table()\" on a different sample text. Each table is, therefore, a different length. I want

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 19:41

    freqs.list <- mapply(data.frame,Words=seq_along(myList),myList,SIMPLIFY=FALSE,MoreArgs=list(stringsAsFactors=FALSE))
    freqs.df <- do.call(rbind,freqs.list)
    res <- reshape(freqs.df,timevar="Words",idvar="Var1",direction="wide")
    head(res)
    

提交回复
热议问题