Extract a dplyr tbl column as a vector

后端 未结 7 1363

Is there a more succinct way to get one column of a dplyr tbl as a vector, from a tbl with database back-end (i.e. the data frame/table can\'t be subset directly)?



        
7条回答
  •  [愿得一人]
    2020-11-22 16:57

    You can also use unlist which I find easier to read because you do not need to repeat the name of the column or specify the index.

    iris2 %>% select(Species) %>% unlist(use.names = FALSE)
    

提交回复
热议问题