Extract a dplyr tbl column as a vector

后端 未结 7 1410

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:48

    I'd probably write:

    collect(select(iris2, Species))[[1]]
    

    Since dplyr is designed for working with tbls of data, there's no better way to get a single column of data.

提交回复
热议问题