這個問題在這里已經有了答案: 在列中拆分分隔字串并作為新行插入 [重復] 6 個答案 2天前關閉。
我有一個資料框,其中一列包含此資料。[email protected]; [email protected]; [email protected]
q= tibble("[email protected]; [email protected]; [email protected]")
separate_rows(q,sep = ";")
uj5u.com熱心網友回復:
您需要指定列。對于您的唯一專欄:
separate_rows(q,1 ,sep = ";")
# A tibble: 3 × 1
`"[email protected]; [email protected]; [email protected]"`
<chr>
1 "[email protected]"
2 " [email protected]"
3 " [email protected]"
uj5u.com熱心網友回復:
如果您命名該列會更清楚。您可能想使用“;”(帶空格)作為分隔符
q <- tibble(email = "[email protected]; [email protected]; [email protected]")
q %>%
separate_rows(email, sep = "; ")
結果:
# A tibble: 3 x 1
email
<chr>
1 info1@domain.com
2 info2@domain.com
3 info3@domain.com
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/419859.html
標籤:
