[R] missing value where TRUE/FALSE needed with R ipolygrowth

Luigi Marongiu m@rong|u@|u|g| @end|ng |rom gm@||@com
Fri May 9 11:31:29 CEST 2025


Dear R-Help,
I am trying to determine the growth rate of bacteria under specific
conditions using
ipolygrowth function `ipg_multisample`. While this worked before, I
got some data that give the error:
```
Error in if (tb.result$peak.growth.time == 0) { :
    missing value where TRUE/FALSE needed
  In addition: Warning message:
    In max(pgr[pgr > 0 & Re(x) >= 0 & Re(x) <= max]) :
    no non-missing arguments to max; returning -Inf
  Error in if (tb.result$peak.growth.time == 0) { :
      missing value where TRUE/FALSE needed
    In addition: Warning message:
      In max(pgr[pgr > 0 & Re(x) >= 0 & Re(x) <= max]) :
      no non-missing arguments to max; returning -Inf
```

I don't have NAs in the data, so I don't understand where the problem
arises, thus I can't generate a working example. The data is too large
to make a dataframe, so I am attaching it ad R object. In the text
below I visualize the data (also attached for ease).
Then I run ipg_multisample.
What would the problem be?
If it were a data fitting problem, I would have gotten a
non-convergence error message; I think this is more about the type of
data passed to the function, but I don't know what the issue is. Any
tip?
Thank you.

```
library(ipolygrowth)
df = readRDS("dfTest.rds")
COL=c("green", "cyan", "red", "blue", "orange", "purple")
plot(OD~Time, df, col="white")
points(OD~Time, df[df$Target==-1,], col=COL[1])
points(OD~Time, df[df$Target==-2,], col=COL[2])
points(OD~Time, df[df$Target==3,], col=COL[3])
points(OD~Time, df[df$Target==7,], col=COL[4])
points(OD~Time, df[df$Target==10,], col=COL[5])
points(OD~Time, df[df$Target==15,], col=COL[6])
legend("topleft", legend=unique(df$Target), pch=16, col=COL)
fit = ipg_multisample(data = df, id = "Target", time.name = "Time",
                      y.name = "OD")
```

-- 
Best regards,
Luigi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Rplot.png
Type: image/png
Size: 204641 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20250509/3c6c024b/attachment.png>


More information about the R-help mailing list