Description Usage Arguments Details Value Author(s) References Examples
Parameter names have differing canonical forms depending on whether they are being used in a NONMEM control stream, an R plot, a latex table, etc. The functions described here form a generalized interface for interconverting these forms, given some xml-encoded data in a file, typically a control stream.
1 2 3 4 |
x |
a vector of parameter names (character) |
within |
an XML ‘document’ containing parameter elements (character) |
by |
the parameter attribute by which to interpret |
as |
the parameter attribute as which to re-present |
type |
the element type to seek in ‘within’ |
... |
passed to other functions |
drop |
for |
clear
helps to isolate XML fragments from a text file. ctl2xml
puts it
to use, assuming the fragments occur after the control stream comment character:
it drops material up to and including the comment character, and then drops
everything up to the first '<'. It is expected that a <parameter> declaration
follows.
lookup.one
is the engine that researches elements of x, one at a time.
lookup
is the typical user interface to this system. Try this.
In your control stream, create parameter comments for each element,
e.g. TVCL = THETA(1) ; <parameter name='THETA1' lattice='TH1' latex='\theta_1'>typical value of clearance</parameter>
In your script, use readLines
to acquire your control stream
as a character vector.
Use ctl2xml
to convert that vector to XML.
Pass the converted vector to lookup
as the argument within
.
All these functions return character. lookup
returns a vector of names
corresponding to x, but having some other form (representing some other attribute).
Tim Bergsma
http://metrumrg.googlecode.com
1 2 3 4 5 6 7 8 9 10 11 | codes <- c(
'; etc <parameter name="THETA1" lattice="TH1" latex="\\Theta_1">wt. on cl.</parameter>',
'and some other stuff',
';<parameter name="OMEGA1" lattice="OM1" latex="\\Omega_1">iiv on vol.</parameter>',
'with maybe a < sign',
';<parameter name="SIGMA1" lattice="SG1" latex="\\Sigma_1">additive error</parameter>'
)
codes
doc <- ctl2xml(codes)
lookup(c('TH1','SG1','OM1',NA),within=doc,by='lattice')
lookup(c('THETA1','SIGMA1','OMEGA1'),within=doc,as='lattice')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.