我有这样的数据
string updateQuery = "UPDATE `pop-sf40-database`.`salons` SET `name` = '" + txtSalonName.Text + "', `adress` = '" + txtSalonAdress.Text + "', `telephone` = '" + txtSalonTelephone.Text + "', `email` = '" + txtSalonEmail.Text + "', `web_site` = '" + txtSalonSite.Text + "', `tin` = '" + txtSalonTin.Text + "', `uid` = '" + txtSalonUid.Text + "', `bank_account` = '" + txtSalonBankAccount.Text + "', `deleted` = '" + 0 + "' WHERE `id` = '"+ txtSalonId.Text + "'" ;
我想让它与众不同。在表单列中,两个字符串不是唯一的A0A067XKR4和A0A067XKW4 我想用a添加其他列值;所以它将是ND4F; ND4和ND1; ND1F
df<- structure(list(from = structure(c(9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 7L, 8L, 8L), .Label = c("A0A023J6K5",
"A0A023J6L7", "A0A023J6M1", "A0A067XG53", "A0A067XKM5", "A0A067XKP8",
"A0A067XKR4", "A0A067XKW4", "A0A0A6YXQ7", "A0A0A6YXW8", "A0A0A6YXX6",
"A0A0A6YXZ1", "A0A0A6YY28", "A0A0A6YY47", "A0A0A6YY78", "A0A0A6YY91"
), class = "factor"), to = structure(c(6L, 11L, 1L, 4L, 12L,
5L, 5L, 5L, 9L, 7L, 9L, 2L, 7L, 3L, 10L, 9L, 7L, 8L), .Label = c("Arhgap15",
"Cask", "COXI", "Igtp", "MumuTL", "Myo1f", "ND1", "ND1F", "ND4",
"ND4F", "Pak2", "pol"), class = "factor")), .Names = c("from",
"to"), class = "data.frame", row.names = c(NA, -18L))
这将显示哪些不是唯一的
from to
1 A0A0A6YXQ7 Myo1f
2 A0A0A6YXW8 Pak2
3 A0A0A6YXX6 Arhgap15
4 A0A0A6YXZ1 Igtp
5 A0A0A6YY28 pol
6 A0A0A6YY47 MumuTL
7 A0A0A6YY78 MumuTL
8 A0A0A6YY91 MumuTL
9 A0A023J6K5 ND4
10 A0A023J6L7 ND1
11 A0A023J6M1 ND4
12 A0A067XG53 Cask
13 A0A067XKM5 ND1
14 A0A067XKP8 COXI
15 A0A067XKR4 ND4F;ND4
17 A0A067XKW4 ND1; ND1F
答案 0 :(得分:0)
一个简单的选择是使用聚合函数,但可能存在其他选项。
aggregate(to ~ from , df, paste,collapse = ";")