> From: han...@depauw.edu
> To: dwinsem...@comcast.net
> Date: Sun, 26 Dec 2010 22:36:49 -0500
> CC: r-h...@stat.math.ethz.ch
> Subject: Re: [R] Parsing a Simple Chemical Formula
>
> Hi David & others...
>
> I did find the function you recommended, plus, it'
> Date: Sun, 26 Dec 2010 20:24:23 -0800
> From: spencer.gra...@structuremonitoring.com
> To: han...@depauw.edu
> CC: r-h...@stat.math.ethz.ch
> Subject: Re: [R] Parsing a Simple Chemical Formula
>
> Mike Marchywka's pos
Mike Marchywka's post mentioned a CRAN package, "rpubchem",
missed by my search for "chemical formula". A further search for
"chemical" and "chemistry" still missed it. "compound" found it.
Adding "compounds" and combining them with "union" produced a list of
564 links in 219 packages;
On Sun, Dec 26, 2010 at 7:26 PM, Gabor Grothendieck
wrote:
> On Sun, Dec 26, 2010 at 6:29 PM, Bryan Hanson wrote:
>> Hello R Folks...
>>
>> I've been looking around the 'net and I see many complex solutions in
>> various languages to this question, but I have a pretty simple need (and I'm
>> not
Hi David & others...
I did find the function you recommended, plus, it's even easier (but a
little hidden in the doc): >element(form, "mass"). But, this uses the
atomic masses from the periodic table, which are weighted averages of
the isotopes of each element. What I'm doing actually inv
On Dec 26, 2010, at 8:28 PM, Bryan Hanson wrote:
Thanks Spencer, I'll definitely have a look at this package and it's
vignettes. I believe I have looked at it before, but didn't catch
it on this particular search. Bryan
Using the thermo list that the makeup function accesses to get its
di...@gmail.com
> Date: Sun, 26 Dec 2010 20:01:45 -0500
> CC: r-h...@stat.math.ethz.ch
> Subject: Re: [R] Parsing a Simple Chemical Formula
>
> Well let me just say thanks and WOW! Four great ideas, each worthy of
> study and I'll learn several things from each. Interestingly,
Thanks Spencer, I'll definitely have a look at this package and it's
vignettes. I believe I have looked at it before, but didn't catch it
on this particular search. Bryan
On Dec 26, 2010, at 8:16 PM, Spencer Graves wrote:
p.s. help(pac=CHNOSZ) reveals that this package has 3 vignettes. I
p.s. help(pac=CHNOSZ) reveals that this package has 3 vignettes. I
have not looked at these vignettes, but most vignettes provide excellent
introductions (though rarely with complete coverage) of important
capabilities of the package. (The 'sos' package includes a vignette,
which exposes mor
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
Well let me just say thanks and WOW! Four great ideas, each worthy of
study and I'll learn several things from each. Interestingly, these
solutions seem more general and more compact than the solutions I
found on the 'net using python and perl. More evidence for the power
of R! A big th
On Dec 26, 2010, at 6:29 PM, Bryan Hanson wrote:
Hello R Folks...
I've been looking around the 'net and I see many complex solutions
in various languages to this question, but I have a pretty simple
need (and I'm not much good at regex). I want to use a chemical
formula as a function ar
On Sun, Dec 26, 2010 at 6:29 PM, Bryan Hanson wrote:
> Hello R Folks...
>
> I've been looking around the 'net and I see many complex solutions in
> various languages to this question, but I have a pretty simple need (and I'm
> not much good at regex). I want to use a chemical formula as a functio
There might be something simpler, but this is what I came up with:
form = "C5H11BrO"
ups = c(gregexpr("[[:upper:]]", form)[[1]], nchar(form) + 1)
seperated = sapply(1:(length(ups)-1), function(x) substr(form, ups[x],
ups[x+1] - 1))
elements = gsub("[[:digit:]]", "", seperated)
nums = gsub("[[:al
try this:
> f.extract <- function(formula)
+ {
+ # pattern to match the initial chemical
+ # assumes chemical starts with an upper case and optional lower
case followed
+ # by zero or more digits.
+ first <- "^([[:upper:]][[:lower:]]?)([0-9]*).*"
+ # inverse of above to
Hello R Folks...
I've been looking around the 'net and I see many complex solutions in
various languages to this question, but I have a pretty simple need
(and I'm not much good at regex). I want to use a chemical formula as
a function argument. The formula would be in "Hill order" which
16 matches
Mail list logo