Reputation: 453
I have a data.table like this:
testDT <- data.table(SFf = as.character(c("C1H1", "C3H4Cl")),
Mult = as.integer(c(3,5))
)
now I am trying to loop over the rows of this table and apply a function (multiform() from the package enviPat) to it like this:
mapply(multiform,testDT$SFf,testDT$Mult)
the output of it should be two strings, namely "C3H3" and "C15H20Cl5". However the function simply never stops calculating and seems to get caught up in an endless loop.
When I apply the function like
multiform("C1H1",3)
it works and I get "C3H3" as output. What am I doing wrong?
Yasel
Upvotes: 0
Views: 94
Reputation: 453
I got it. The problem was that the function multiform() does not allow elements without numbers behind them. So it wont take "C3H4Cl" but "C3H4Cl1".
I don't think that this is intended and will try to contact the authors of the package.
Upvotes: 2