RStudio Crash with large character vector using Rdisop function

Hi all,
I have the following code which crashes when using a very large number for the iteration loop. I try to cycle through a list of chemical formulas which are stored in a character vector with 43000 elements with the function getMolecule from the Rdisop library. When I try this with up to 1000 formulas, it does work. But the code crashes RStudio when I iterate through a larger number exceeding 1100 or so.
In the code I try to re-initialize the variable which the getMolecule-function writes to because it also crashed when I tried to write a list directly with the function.
I am pretty new to R, does anyone have a suggestion how to fix this problem?
Thanks
Cyrus

library(Rdisop)

pr.mass <- c()
pr.formula <- c()

for (i in 1:1200)
{
sumformula <- c()
exactmass <- c()
sumformula <- getMolecule(formulas[i])$formula
exactmass <- getMolecule(formulas[i])$exactmass
pr.mass <- append(pr.mass, exactmass)
pr.formula <- append(pr.formula, sumformula)
}


The implication is that the implementation of getMolecule isnt memory safe in Windows ... :frowning:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.