我将一个数据帧(df1)作为单列数据删除。
1
2 Amazon Pantry
3 Best Sellerin Soaps & Hand Wash
4
5 Palmolive Hygiene-Plus Sensitive Liquid Hand Wash, 300ml
6 Palmolive Hygiene-Plus Sensitive Liquid Hand Wash, 300ml
7 £0.90
8 ?
9
10 Palmolive Naturals Nourishing Liquid Hand Wash, 300ml
11 Palmolive Naturals Nourishing Liquid Hand Wash, 300ml
12 £0.90
13 ?
14
15 L'Oreal Men Expert Carbon Protect Deodorant 250ml
16 L'Oreal Men Expert Carbon Protect Deodorant 250ml
17 £1.50为了清理数据,我尝试使用以下命令,以便在两个单独的列中获取产品和定价信息。有没有人可以告诉我有没有别的办法。
install.packages("splitstackshape")
newdf <- cSplit(df1, "Amazon_Normal_Text2", direction = "long")发布于 2017-06-22 06:38:29
这只是一个思考的过程。
每次出现"ml“时,提取信息,直到ml向后返回,直到有空格,并将其存储到卷变量中。从£到字符串末尾的价格信息并将其存储到(substr)
nchar)
nchar)
,grep,regex,grep)产品变量(regex,substr
查看substr、nchar、grep、regex
https://stackoverflow.com/questions/44686118
复制相似问题