[R] Need to Write a Code that can find the molecular weight of various compounds

matthew.ttd.nguyen matthew.ttd.nguyen at gmail.com
Tue Feb 7 19:53:51 CET 2012

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, 
showData(FakeCompounds, placement='-20+200', font=getRcmdr('logFont'), 
  maxwidth=80, maxheight=30)
FakeCompounds$Molecular.Mass <- with(FakeCompounds, 

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: 

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!

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.

More information about the R-help mailing list