Turning a dataframe into a named vector

前端 未结 2 1085
野的像风
野的像风 2021-01-22 15:08

I applied a model (wordscore) on my dfm. As a result I got an object of output whose class is \"textmodel_wordscores\" \"textmodel\" \"list\". I am interested in the output \"wo

2条回答
  •  没有蜡笔的小新
    2021-01-22 15:49

    We can also use deframe

    library(tibble)
    deframe(df)
    #commitment   progress  implement   decision    message    deficit 
    #-0.9843452 -0.9831530 -0.9785868 -0.9777243 -0.9762919 -0.9752300 
    

    In base R, names<- can be used as well

    with(df, `names<-`(Score, Words))
    

提交回复
热议问题