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

Integer variables not handled by some functions #553

Closed
pchelle opened this issue Jul 8, 2021 · 8 comments
Closed

Integer variables not handled by some functions #553

pchelle opened this issue Jul 8, 2021 · 8 comments
Labels
type: bug Something isn't working

Comments

@pchelle
Copy link
Contributor

pchelle commented Jul 8, 2021

Sometimes observed data are assumed as integer and not numeric variables by R, which crashes the function toUnit with the error message below. It could be helpful to enforce integer variables into numeric within functions such as toUnit (using as.numeric ?)

ospsuite::toUnit("Time", as.integer(c(1,2,3)), "h")

Error in rClr::clrCall(dimensionTask, "ConvertToUnit", dimension, targetUnit,  : 
  Type:    System.MissingMethodException
Message: Could not find a suitable instance method ConvertToUnit on type OSPSuite.R.Services.DimensionTask for method parameters String, String, Int32[]
Method:  Void ThrowMissingMethod(System.Type, System.String, System.String, System.Type[])
Stack trace:
   at Rclr.ReflectionHelper.ThrowMissingMethod(Type classType, String methodName, String modifier, Type[] types)
   at Rclr.ClrFacade.InternalCallInstanceMethod(Object obj, String methodName, Boolean tryUseConverter, Object[] arguments)
@Yuri05
Copy link
Member

Yuri05 commented Jul 8, 2021

ospsuite::toUnit("Time", as.integer(1), "h") works though...

@PavelBal
Copy link
Member

PavelBal commented Jul 8, 2021

Where do you get values that are integer and not numeric from? Just curious what is the use case.

@pchelle
Copy link
Contributor Author

pchelle commented Jul 8, 2021

When reading an observed dataset from a csv file and all the values within a column are integers, R assumes that their class is integer and not numeric.
Since before plotting the data, we need to convert them to a display unit, it creates this crash on some test examples.

@pchelle
Copy link
Contributor Author

pchelle commented Jul 8, 2021

More specifically it is usually the time variable of observed data which includes only integers

@PavelBal
Copy link
Member

@pchelle could you provide an example csv file and the code how you read it?

@pchelle
Copy link
Contributor Author

pchelle commented Jul 16, 2021

To read the observed data, RE function is readObservedDataFile but it is based on

read.csv(fileName,
      header = TRUE,
      check.names = FALSE,
      encoding = "UTF-8"
    )

@pchelle
Copy link
Contributor Author

pchelle commented Jul 16, 2021

The example is in the zip
Itraconazole 600mg MD.zip

@msevestre msevestre added the type: bug Something isn't working label Sep 14, 2021
msevestre added a commit that referenced this issue Sep 14, 2021
@msevestre
Copy link
Member

@pchelle Fixed. Updating reportingengine with this build

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

No branches or pull requests

4 participants