pveber / morse

Companion R package for MOSAIC website
7 stars 5 forks source link

LCx function #285

Closed sandrinecharles closed 3 years ago

sandrinecharles commented 3 years ago

La fonction LCx renvoie des warnings sans doute liés au package dplyr :

Warning messages: 1: Problem withmutate()inputconcentration. ℹ collapsing to unique 'x' values ℹ Inputconcentrationiszoo::na.approx(concentration, q50, na.rm = FALSE). 2: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) : collapsing to unique 'x' values 3: Problem withmutate()inputconcentration. ℹ collapsing to unique 'x' values ℹ Inputconcentrationisna.approx(concentration, qinf95, na.rm = FALSE). 4: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) : collapsing to unique 'x' values 5: Problem withmutate()inputconcentration. ℹ collapsing to unique 'x' values ℹ Inputconcentrationisna.approx(concentration, qsup95, na.rm = FALSE). 6: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) : collapsing to unique 'x' values

virgile-baudrot commented 3 years ago

It's a warning from approx function not linked to dplyr.

Minimal working example:

When doing this (morse version 3.2.7):

library(morse)
data("propiconazole")
survData_PRZ = survData(propiconazole)
fit_cstSD = survFit(survData_PRZ, model_type = "SD")
LCx(fit_cstSD, X = 50)

I get the same warning message:

Warning messages:
1: Problem with `mutate()` input `concentration`.
i collapsing to unique 'x' values
i Input `concentration` is `zoo::na.approx(concentration, q50, na.rm = FALSE)`. 
2: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
  collapsing to unique 'x' values
3: Problem with `mutate()` input `concentration`.
i collapsing to unique 'x' values
i Input `concentration` is `na.approx(concentration, qinf95, na.rm = FALSE)`. 
4: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
  collapsing to unique 'x' values
5: Problem with `mutate()` input `concentration`.
i collapsing to unique 'x' values
i Input `concentration` is `na.approx(concentration, qsup95, na.rm = FALSE)`. 
6: In regularize.values(x, y, ties, missing(ties), na.rm = na.rm) :
  collapsing to unique 'x' values

Problem

It comes from our function pointsLCx used in LCx.survFit.R which call na.approx() function itself calling approx() function.

For instance here, every thing is fine: image

But when looking in more tricky part like here, results are harder to deal with: image

The problem is that warning is everywhere because of the 2nd situation!

virgile-baudrot commented 3 years ago

It is solved now!