Skip to content
Prev 245815 / 398506 Next

Parsing a Simple Chemical Formula

Have you considered the 'CHNOSZ' package?


 > makeup("C5H11BrO" )
    count
C      5
H     11
Br     1
O      1


       I found this using the 'sos' package as follows:


library(sos)
cf <- ???'chemical formula'
found 21 matches;  retrieving 2 pages
cf


       The print method for "cf" opened the results in a web browser, 
which showed that the "CHNOSZ" package had 14 of these 11 matches, and 
the other 7 were in 7 different packages.  Moreover, the "CHNOSZ" 
package is devoted to "Chemical Thermodynamics and Activity Diagrams" 
and provides many more capabilities that might interest you.


       Hope this helps.
       Spencer
On 12/26/2010 5:01 PM, Bryan Hanson wrote: