Creating a new Standard Output file from scratch

Creating a simple SO with PopulationEstimate

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

And written using so$so_write("filename.SO.xml")



Try the libsoc package in your browser

Any scripts or data that you put into this service are public.

libsoc documentation built on May 15, 2019, 5:15 p.m.