Convert a row of a data frame to vector

前端 未结 6 627
予麋鹿
予麋鹿 2020-12-04 09:05

I want to create a vector out of a row of a data frame. But I don\'t want to have to row and column names. I tried several things... but had no luck.

This is my data

6条回答
  •  天涯浪人
    2020-12-04 09:13

    Here is a dplyr based option:

    newV = df %>% slice(1) %>% unlist(use.names = FALSE)
    
    # or slightly different:
    newV = df %>% slice(1) %>% unlist() %>% unname()
    

提交回复
热议问题