【发布时间】:2016-11-26 09:14:08
【问题描述】:
有没有一种方法可以在数据行中搜索模式,然后将它们存储在新表的单独列中?例如,如果我需要从下面的身体中提取金额、钞票和硬币,你认为在 R 上可以达到预期的结果吗
user_id | ts | body | address |
3633| 2016-09-29| A wallet with amount = $ 100 has been found with 4 bills and 5 coins| TEST |
4266| 2016-07-20| A purse having amount = $ 150 has been found with 40 bills and 15 coins| NAME |
7566| 2016-07-20| A pocket having amount = $ 200 has been found with 4 bills and 5 coins| HELLO |
(这是想要的结果)
user_id | Amount | Bills| Coins|
3633 | $100 | 4 | 5|
4266 | $150 | 40 | 15|
7566 | $200 | 10 | 10|
【问题讨论】:
-
是的,有可能。您将需要使用正则表达式。见
?regex。 effect of this 的东西。
标签: r text pattern-matching analysis text-mining