我有一个带有以下示例值的数据框。
[1] "entry.cei"
[2] "entry.lifecycle->hist.open.personal demand chequing account->exit.lifecycle->entry.cei"
[3] "entry.lifecycle->hist.open.personal demand savings account->exit.lifecycle->entry.cei"
[4] "entry.transaction->txn.no source available->exit.transaction->entry.cei"
[5] "entry.branch->exit.branch->entry.transaction->txn.in-branch->exit.transaction->entry.cei"
我需要通过“->”将它们拆分,将它们放在不同的列中,比如 V1、V2 等。例如:
V1 V2 V3 V4 V5 V6 V7
1 entry.cei
2 entry.lifecycle hist.open.personal demand chequing account exit.lifecycle entry.cei
3 entry.lifecycle hist.open.personal demand savings account exit.lifecycle entry.cei
我怎样才能在 R 中实现这一点?我尝试将 rbind 与 strsplit() 一起使用,但我认为它需要相同数量的列。