从tbl_df转换为向量

时间:2019-02-04 21:14:46

标签: r types

我下面有一个tbl_df格式的数据集:

dput(sample_beast)

structure(list(user_id = c("1065083171501428736", "1084652637608267778", 
"1498500199", "1092488473804558336", "1087762163194724353", "1089218786966884352"
)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"
))

我尝试将其转换为向量,但最后得到奇怪的斜线和截断的消息:

sample_beast<-as.data.frame(sample_beast)
sample_beast<-as.character(sample_beast)

sample_beast

[1] "c(\"1065083171501428736\", \"1084652637608267778\", \"1498500199\", 
\"1092488473804558336\", \"1087762163194724353\", \"1089218786966884352\")"

如何解决此问题,使其成为不带有斜杠的法线矢量?

预期输出:

str(sample_beast)

chr [1:6] "1065083171501428736" "1084652637608267778" "1498500199" 
"1092488473804558336" ...

0 个答案:

没有答案