Thanks Paul,

I was trying to get the function for getMass to input into another column
into a data set using R code: 

FakeCompounds$Molecule <- with(FakeCompounds, 
  getMolecule(Molecular.Formula))
showData(FakeCompounds, placement='-20+200', font=getRcmdr('logFont'), 
  maxwidth=80, maxheight=30)
FakeCompounds$Molecular.Mass <- with(FakeCompounds, 
  getMass(Molecular.Formula))

which gave me the response error: [24] ERROR:  $ operator is invalid for
atomic vectors

Which I didn't quite understand in the context of Rdisop, does it only allow
for one variable at a time?

So I tried to create a loop, ending up with: 

c(getFormula(getMolecule("CH3")),getFormula(getMolecule("CH2")))->B
i<-1
for (i in 1:length(B)){G[i]<-getMass(B[i])}

but I still get the same error: [25] ERROR:  $ operator is invalid for
atomic vectors

The final goal is to have a list that can calculate molecular mass from a
list of chemical formulas.

Any help? I'm not sure if this is a problem only related to Rdisop or not.
Thanks a lot!
Matt

--
View this message in context: 
http://r.789695.n4.nabble.com/Need-to-Write-a-Code-that-can-find-the-molecular-weight-of-various-compounds-tp4342874p4365836.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to