亲爱的, A有这样的字符串:
a <- "Good,Good*********,Good***********,Perfect,Perfect**********,Perfect***********"
现在我想把它分成这个:
a <- c("Good","Good*********","Good***********","Perfect","Perfect**********","Perfect***********")
非常欢迎任何建议!谢谢你,
Lisanne
答案 0 :(得分:7)
strsplit
这样做:
a<-"Good,Good***,Good****,Perfect,Perfect***,Perfect*****"
a <- strsplit(a, ",")[[1]]
答案 1 :(得分:0)
此类问题是scan
:
scan(text = a, what = "", sep = ",")
# Read 6 items
# [1] "Good" "Good*********" "Good***********" "Perfect"
# [5] "Perfect**********" "Perfect***********"