r - 按每行中的括号标题拆分和重新排列列
问题描述
dput(df)
structure(list(Parties = structure(c(2L, 3L, 1L), .Label = c("City (Plaintiff) Doe, John (Defendant)",
"John Doe Enterprises Inc (Plaintiff) Doe, John (Defendant) Does 1-5, John (Defendant)",
"John Doe Properties LLC (Plaintiff) Doe, Jane (Defendant) Doe, Jane (Defendant)"
), class = "factor")), class = "data.frame", row.names = c(NA,
-3L))
我希望把它分开,这样我就有几列原告和几列被告,就像这样(或类似的东西):
但是我很难弄清楚我的 R 代码应该是什么样子。有什么想法吗?
解决方案
推荐阅读
- rust - 我无法理解这个 MCVE 中的生命周期问题,灵感来自我的 ODE 求解器代码
- python - 外语测验和计数结果
- java - 如何在二维数组 Java 上仅更改和显示一列(通过用户输入)
- python - Pandas 将数据框值转换为列名
- python - 如何修复“TypeError:'NoneType'对象不可下标”?
- javascript - 将第二个孩子添加到下拉菜单
- maven - 从 lib-release 而不是 lib-snapshot 下载 Maven 版本
- powershell - 获取 ADUser -Identity
- swift - 按 ID 编辑所有记录(Swift 4、CoreData)
- android - Automatic updates on Android devices (Apps) - Kotlin