我有一个帧数据“testData”如下:
id content
1 I came from China
2 I came from America
3 I came from Canada
4 I came from Japan
5 I came from Mars
而且我还有另一个帧数据“addr”如下:
id addr
1 America
2 Canada
3 China
4 Japan
那么我如何使用grepl
,sapply
或 R 中的任何其他有用函数将数据生成如下:
id content addr
1 I came from China China
2 I came from America America
3 I came from Canada Canada
4 I came from Japan Japan
5 I came from Mars Mars