Closed billdenney closed 6 years ago
I think this is too niche for janitor. I'm trying to think of where it would belong. A package for a specific domain of work? MALDIquant::match.closest
looks very similar:
c(1, 2, 4)[match.closest(c(1.01, 0.99, 2.04, 2.08, 4.2, 4.1), c(1, 2, 4))]
[1] 1 1 2 2 4 4
https://www.rdocumentation.org/packages/MALDIquant/versions/1.18/topics/match.closest
That's perfectly fair. Thanks for finding match.closest()
!
In my data cleaning workflow, I often receive or extract data that should come from a limited set of values. The challenge is that the actual data doesn't have those values within. Most commonly, this occurs when extracting data from an image (using https://automeris.io/WebPlotDigitizer/ or similar).
Values may come in like: 1.01, 0.99, 2.04, 2.08, 4.2, 4.1
When they should come from the set: 1, 2, 4
I have a function (below) that is able to clean these data to match the closest value within the set. Is this of interest for janitor?