Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding molarity? #362

Closed
sardnar opened this issue Dec 21, 2023 · 3 comments
Closed

Adding molarity? #362

sardnar opened this issue Dec 21, 2023 · 3 comments

Comments

@sardnar
Copy link

sardnar commented Dec 21, 2023

Hi,
Thank you for this cool work. I have a request for adding molarity units. molarity is a chemical unit for concentration. 1M = mol/L. 1uM = 1micro mol /L ... etc. I think this could be applied by the symbols of M, mM, uM, nM ... etc.

A tough part however is that moles is a standardized quantity of weight by molecular mass. So 1 mol of calcium = 40 gms.

Is some extension like that possible?

@Enchufa2
Copy link
Member

We rely on udunits2, and molarity is not defined in that database, but we provide a mechanism to extend the database with new units. In this case, you need:

install_unit("M", "1 mol/L", "molarity")

and you are good to go.

About moles of substances, it's a complicated problem, yes. There's an ongoing effort to address this in a separate package, see r-quantities/substances#1.

@sardnar
Copy link
Author

sardnar commented Dec 22, 2023

Thanks! When I follow this discussions, I can find a talk about install_conversion_constant() function in units package. However, I can't find it exported?

@Enchufa2
Copy link
Member

That's an old function, long gone. install_unit is the replacement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants