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

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri May 9 17:51:08 CEST 2025


Your example is not reproducible. I recommend using the reprex package to get your examples in shape.

You don't have to have NA in your data to encounter a problem... all you need is transformations during your analysis that runs into domain violations to create NA along the way... negative numbers into powers or log or sqrt... kind of things. Read the documentation for your analysis packages carefully.

On May 9, 2025 2:31:29 AM PDT, Luigi Marongiu <marongiu.luigi using gmail.com> wrote:
>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")
>```
>

-- 
Sent from my phone. Please excuse my brevity.



More information about the R-help mailing list