我想在 和 之间重复字符串的某些部分,]
作为由前面;
分隔的元素的数量within 。因此,所需的输出将是. 任何开始的提示。谢谢;
[]
[A1, AB11; A2, AB22] I1, C1
[A1, AB11] I1, C1; [A2, AB22] I1, C1
df1 <-
data.frame(
String = c(
"[A1, AB11; A2, AB22] I1, C1; [A3, AB33] I3, C1"
, "[A4, AB44] I4, C4; [A5, AB55; A6, AB66; A7, AB77] I7, C7"
)
)
df1
String
1 [A1, AB11; A2, AB22] I1, C1; [A3, AB33] I3, C1
2 [A4, AB44] I4, C4; [A5, AB55; A6, AB66; A7, AB77] I7, C7
df2 <-
data.frame(
String = c(
"[A1, AB11] I1, C1; [A2, AB22] I1, C1; [A3, AB33] I3, C1"
, "[A4, AB44] I4, C4; [A5, AB55] I7, C7;[A6, AB66] I7, C7; [A7, AB77] I7, C7"
)
)
df2
String
1 [A1, AB11] I1, C1; [A2, AB22] I1, C1; [A3, AB33] I3, C1
2 [A4, AB44] I4, C4; [A5, AB55] I7, C7;[A6, AB66] I7, C7; [A7, AB77] I7, C7