Hi! Just started working at a lab and have only minimal experience with R.
I was wondering if there was a way to write a code that would intake a data set of chemical compounds (ex: H2O, CH3) and be able to give an output column of the molecular weight? I tried some really basic coding to try to work with a being a matrix of data with the assigned variables. if (A<-'H') A<-a[50,3] else (B<-'O') B<-a[86,3] ifelse (A=='H',A<-a[50,3],ifelse(B=='O',B<-a[86,3],0] I was thinking to have the program read the formula and compute the output of molecular mass by reading information off of a separate data sheet with the individual weights of the molecules, and then output that into another column. Any suggestions? Thanks! -- 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-tp4342874p4342874.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.