【发布时间】:2021-02-10 03:38:23
【问题描述】:
我有一个数据框(数据框 A),其中每一行都包含一些文本:
df_A = structure(list(Text = c("To this end, we strongly support the Commission in its determination to promote the renewed Lisbon Strategy and we encourage national governments to show their determination in this regard by implementing structural reforms in Europe. In fact, incoming information since the last Governing Council meeting indicates a more protracted weakness of the euro area economy, the persistence of prominent downside risks and muted inflationary pressures. This is the type of text that I would like to cancel and keep only the other one. This is reflected in the new staff projections, which show a further downgrade of the inflation outlook.",
"To this end, we strongly support the Commission in its determination to promote the renewed Lisbon Strategy and we encourage national governments to show their determination in this regard by implementing structural reforms in Europe. There are super skilled people in SO who will hopefully help me sort this out. In fact, incoming information since the last Governing Council meeting indicates a more protracted weakness of the euro area economy, the persistence of prominent downside risks and muted inflationary pressures. This is reflected in the new staff projections, which show a further downgrade of the inflation outlook.",
"To this end, we strongly support the Commission in its determination to promote the renewed Lisbon Strategy and we encourage national governments to show their determination in this regard by implementing structural reforms in Europe. I would really like to remove this bit and I hope that SE will sort it out. In fact, incoming information since the last Governing Council meeting indicates a more protracted weakness of the euro area economy, the persistence of prominent downside risks and muted inflationary pressures. This is reflected in the new staff projections, which show a further downgrade of the inflation outlook."
)), class = "data.frame", row.names = c(NA, -3L))
然后我从上面的数据帧 A 中提取了另一个数据帧(数据帧 B):
df_B = structure(list(Text = c("This is the type of text that I would like to cancel and keep only the other one.",
"There are super skilled people in SO who will hopefully help me sort this out.",
"I would really like to remove this bit and I hope that SE will sort it out."
)), class = "data.frame", row.names = c(NA, -3L))
我想做的是从数据框A中的文本中减去数据框B中的文本以获得数据框C:
# df_C = df_A - df_B
[[1]]"To this end, we strongly support the Commission in its determination to promote the renewed Lisbon Strategy and we encourage national governments to show their determination in this regard by implementing structural reforms in Europe. In fact, incoming information since the last Governing Council meeting indicates a more protracted weakness of the euro area economy, the persistence of prominent downside risks and muted inflationary pressures. This is reflected in the new staff projections, which show a further downgrade of the inflation outlook."
[[2]] "To this end, we strongly support the Commission in its determination to promote the renewed Lisbon Strategy and we encourage national governments to show their determination in this regard by implementing structural reforms in Europe. In fact, incoming information since the last Governing Council meeting indicates a more protracted weakness of the euro area economy, the persistence of prominent downside risks and muted inflationary pressures. This is reflected in the new staff projections, which show a further downgrade of the inflation outlook."
[[3]] "To this end, we strongly support the Commission in its determination to promote the renewed Lisbon Strategy and we encourage national governments to show their determination in this regard by implementing structural reforms in Europe. In fact, incoming information since the last Governing Council meeting indicates a more protracted weakness of the euro area economy, the persistence of prominent downside risks and muted inflationary pressures. This is reflected in the new staff projections, which show a further downgrade of the inflation outlook."
有人可以帮我做吗?
【问题讨论】:
标签: r string dataframe replace