I'm working with a chemical dataset and I was wondering about the smartest way to do the following thing. My dataset looks something like this:
formula Temperature (Kelvin) (Physical) Property Value
CO2 298 5
CO2 298 7.6
CO2 300 3.2
NaCl 300 3.4
NaCl 296 1.4
H2O 298 7.2
H2O 298 8.3
H2O 293 6.4
ZnO 300 3.10
ZnO 290 1.2
FeO 295 4.6
FeO 290 3.6
Given that Room Temperature := 298K,
what I would like to accomplish is to filter the original dataset in order to have only values reported with Room Temperature when it is available, and if there's no value reported at room temperature, I would like to keep the closest value to the room temperature that is available. According to what I would like to achieve, the sample initial dataset above would become something like
formula Temperature (Kelvin) (Physical) Property Value
CO2 298 5
CO2 298 7.6
NaCl 300 3.4
H2O 298 7.2
H2O 298 8.3
ZnO 300 3.10
FeO 295 4.6
Maybe I should use a lambda expression?
Any suggestions on how to achieve something like this?
Many thanks,
James