Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird LLOQ printing #1123

Open
pchelle opened this issue Sep 15, 2022 · 3 comments
Open

Weird LLOQ printing #1123

pchelle opened this issue Sep 15, 2022 · 3 comments
Assignees
Labels
prio: high type: bug Something isn't working

Comments

@pchelle
Copy link
Contributor

pchelle commented Sep 15, 2022

When trying to set and check an LLOQ value in DataSet objects,
The value is oddly printed

> dataSet <- DataSet$new(name = "test")
> dataSet$LLOQ <- 1
> print(dataSet)

DataSet: 
   Name: test 
   X dimension: Time 
   X unit: h 
   Y dimension: Concentration (mass) 
   Y unit: mg/l 
   Error type: 
   Error unit: 
   Molecular weight: 
   LLOQ: 0.999999997475243
   Meta data: 
list()

while the value seems correct

> print(dataSet$LLOQ)
[1] 1
@Yuri05 Yuri05 added type: bug Something isn't working prio: high labels Sep 15, 2022
@PavelBal
Copy link
Member

Lol, it's the way how R (studio?) prints things in the console.

The actual value of dataSet$LLOQ is 0.99999... (see ".Last.value), print to console rounds it up.

image

0.9999... instead of 1 arises from unit conversion. When the user sets 1 as LLOQ, it is supposed to be "mg/l", and the value is internally converted to the base unit of the dimension... with numerical imperfection. Nothing we can do here.

@Yuri05
Copy link
Member

Yuri05 commented Sep 16, 2022

With the printing setting of 7 decimal places (R default) I would still expect that the print function of the dataset rounds correctly.

E.g. with the standrad print function:

> getOption("digits")
[1] 7
> print(0.999999997475243)
[1] 1

But with the dataset still:

> print(dataSet)
DataSet: 
   ...
   LLOQ: 0.999999997475243 
   ...

Why?

@Yuri05
Copy link
Member

Yuri05 commented Sep 16, 2022

I think the error is in the printline function of ospsuite.utils:

https://github.com/Open-Systems-Pharmacology/OSPSuite.RUtils/blob/409d2382eb49f04e9e332a126452b89b0cc2a6e5/R/printable.R#L40-L42

It just prints the value via cat.
But it should check first if the value is numeric and e.g. convert it to string using the format function.
Then the output would be as expected.

> format(dataSet$LLOQ)
[1] "1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: high type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants