lookup: Lookup Alternate Versions of Parameter Codes

Description Usage Arguments Details Value Author(s) References Examples

Description

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.

Usage

1
2
3
4
lookup(    x, within, by = 'name', as = NULL, type = 'parameter', ...)
lookup.one(x, within, by = 'name', as = NULL, type = 'parameter', ...)
ctl2xml(   x, ...)
clear(     x, drop = NULL, ...)

Arguments

x

a vector of parameter names (character)

within

an XML ‘document’ containing parameter elements (character)

by

the parameter attribute by which to interpret x

as

the parameter attribute as which to re-present x. If null, the text value of the element (if any) is returned.

type

the element type to seek in ‘within’

...

passed to other functions

drop

for clear: a vector of patterns to be replaced sequentially with '' (nothing)

Details

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.

Value

All these functions return character. lookup returns a vector of names corresponding to x, but having some other form (representing some other attribute).

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

Examples

 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')

metrumrg documentation built on May 2, 2019, 5:55 p.m.