This section will walk you through the creation of a simple SO file.
First we create the data structure with the maximum likelihood parameter estimates.
MLE <- data.frame(POP_CL=2.23, POP_V=40, IVCL=0.4, IVV=0.3)
Next we add the additional columnType attribute.
attributes(MLE)$columnType <- list(c("structuralParameter"), c("structuralParameter"), c("varParameter", "variance"), c("varParameter", "variance"))
This sets POP_CL and POP_V to be structural parameters and IVCL and IVV to be variability parameters on the variance scale.
The next step is to create the PopulationEstimates object.
library(libsoc)
popest <- so_PopulationEstimates$new()
The MLE data.frame can now be attached.
popest$MLE <- MLE
Now we create the parent objects of the PopulationEstimates.
est <- so_Estimation$new()
est$PopulationEstimates <- popest
block <- so_SOBlock$new()
block$blkId <- "myEstimationRun"
block$Estimation <- est
so <- so_SO$new()
so$add_SOBlock(block)
It is possible to add messages using a convenient method
block$add_message("WARNING", "myTool", "name_of_warning", "This is the description", 2)
Another method adds a rawresults datafile from the tool.
block$add_rawresults_datafile("Description", "file", "id1")
The resulting structure can be inspected
so
## Reference class object of class "so_SO"
## Field "id":
## NULL
## Field "metadataFile":
## NULL
## Field "Description":
## NULL
## Field "PharmMLRef":
## NULL
## Field "SOBlock":
## [[1]]
## Reference class object of class "so_SOBlock"
## Field "blkId":
## [1] "myEstimationRun"
## Field "ToolSettings":
## NULL
## Field "RawResults":
## Reference class object of class "so_RawResults"
## Field "DataFile":
## [[1]]
## data frame with 0 columns and 0 rows
##
## Field "GraphicsFile":
## NULL
## Field ".cobj":
## <pointer: 0x56123b65cca0>
## Field "TaskInformation":
## Reference class object of class "so_TaskInformation"
## Field "Message":
## [[1]]
## Reference class object of class "so_Message"
## Field "type":
## [1] "WARNING"
## Field "Toolname":
## [1] "myTool"
## Field "Name":
## [1] "name_of_warning"
## Field "Content":
## [1] "This is the description"
## Field "Severity":
## [1] 2
## Field ".cobj":
## <pointer: 0x56123be38a80>
##
## Field "OutputFilePath":
## NULL
## Field "RunTime":
## NULL
## Field "NumberChains":
## NULL
## Field "NumberIterations":
## NULL
## Field ".cobj":
## <pointer: 0x56123ad58bc0>
## Field "Estimation":
## Reference class object of class "so_Estimation"
## Field "PopulationEstimates":
## Reference class object of class "so_PopulationEstimates"
## Field "MLE":
## POP_CL POP_V IVCL IVV
## 1 2.23 40 0.4 0.3
## Field "Bayesian":
## NULL
## Field "OtherMethod":
## NULL
## Field ".cobj":
## <pointer: 0x56123c1ce6b0>
## Field "PrecisionPopulationEstimates":
## NULL
## Field "IndividualEstimates":
## NULL
## Field "PrecisionIndividualEstimates":
## NULL
## Field "Residuals":
## NULL
## Field "Predictions":
## NULL
## Field "OFMeasures":
## NULL
## Field "TargetToolMessages":
## NULL
## Field ".cobj":
## <pointer: 0x56123b1adec0>
## Field "Simulation":
## NULL
## Field "ModelDiagnostic":
## NULL
## Field "OptimalDesign":
## NULL
## Field ".cobj":
## <pointer: 0x56123beaafe0>
##
## Field ".cobj":
## <pointer: 0x56123af0a2b0>
And written using so$so_write(“filename.SO.xml”)