Matching Numbers in R


#1

Good Day

I want to do something not too complicated in my terms, cause I have two files with store turnovers and I want to match the turnovers partially for instance if one store has a turnover of 112 and the other has a turnover of 115 then these should be matched, not sure how I go about doing this if there are any ideas please share I would highly appreciate this

Thanks in advance!


#2

It all depends on the files themselves and what form their contents are in. Are you just wanting to look for the digits 112 and/or 115 in the file?

If so, the Rust Cookbook has an example of reading lines from a file and strings have a contains() method to see whether one string occurs within another.


#3

Hi Michael, no actually the store turnovers vary from small to extremely big numbers hence making it difficult to actually match correctly.

Thanks for the help


#4

If you can show us an example of the file contents and point out the particular bits you want then it’s not hard to do.

The standard solution for searching a body of text for a specific pattern is to use regular expressions and the regex crate has proven itself to be a very high quality library.


#5

image

The image attached shows the two files file one with two store and file 2 with two stores as well and now we need to match similar stores based on the ACV regardless of the period or shopid.

see store one in file 1 has a similar acv turnover as store one in file 2, hence these should be matched the same goes for store 2 in file 1 and store 2 in file 2.

Hope this all makes perfect sense now.