as.nm: Create and Manipulate nm Objects

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Objects of class nm are intended to support analysis using the software NONMEM ((c), Icon Development Solutions). nm gives a zero-row data.frame with suitable columns and column classes (essentially, a template for dataset construction). as.nm and as.nm.data.frame construct an nm object from an existing object. The read and write methods are wrappers for ‘.csv’ equivalents. read.nm reconstitutes classes for flags, DATETIME, and C.

Usage

1
2
3
4
5
nm()
## S3 method for class 'data.frame'
as.nm(x, ...)
read.nm(x,na.strings='.',as.is=TRUE,key=c('SUBJ','TIME','SEQ'),flags=character(0),...)
write.nm(x, file, na = '.', row.names = FALSE, quote = FALSE, ...)

Arguments

x

data.frame or nm

na.strings

passed to read.csv

as.is

passed to read.csv

key

passed to as.keyed

flags

character vector naming colums to convert using as.flag

...

extra arguments, ignored or passed to write.csv

file

passed to write.csv

na

passed to write.csv

row.names

passed to write.csv

quote

passed to write.csv

Details

as.nm.data.frame is the principal method that creates an nm classification. It alone enforces all qualities of class nm. read.nm is the only other function that creates an nm classification; use with caution, as it does not enforce all qualities.

Just before as.nm.data.frame returns, it calls as.nm on each of its columns: a non-operation (as.nm.default) unless the user supplies specialized classes and methods. Column-specific methods may make use of the passed argument data, which contains the data set itself. Any enforced or conditional outputs (see column summary) have the column name as the first member of the class vector.

Column summary:

Value

write.nm is used for side effects. Others return an object with class c('nm','keyed','data.frame').

Note

Assembly chains, such as nm() + dose + samp | demo, are no longer supported. Nor are as.moot and as.rigged.

Author(s)

Tim Bergsma

References

http://metrumrg.googlecode.com

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## Not run: metrumrgURL('example/project/script/assemble.pdf')

dose <- data.frame( 
	SUBJ = rep(letters[1:3], each = 2), 
	HOUR = rep(c(0,20),3), 
	AMT = rep(c(40,60,80), each = 2) 
) 
dose <- as.keyed(dose,key=c('SUBJ','HOUR'))
samp <- data.frame( 
	SUBJ = rep(letters[1:3], each = 4), 
	HOUR = rep(c(0,10,20,30),3), 
	DV = signif(rnorm(12),2) + 2 
) 
samp <- as.keyed(samp,key=c('SUBJ','HOUR'))
demo <- data.frame( 
	SUBJ = letters[2:5], 
	RACE = c('asian','white','black','other'), 
	SEX = c('female','male','female','male'), 
	WT = c(75, 70, 73, 68) 
)
demo <- as.keyed(demo,key=c('SUBJ'))
meds <- as.keyed(
	data.frame(
		SUBJ=c('a','c'),
		HOUR=c(0,15),
		STOP=c(10,25),
		C3A4=as.flag(c(1,1))
	),
	key=c('SUBJ','HOUR')
)

nm()
#nm() + dose
as.nm(dose)
as.nm(dose + samp)
as.nm(dose + samp | demo) #as.nm executes once

meds
long <- deranged(meds,start='HOUR',stop='STOP')
long$EVID <- 2
as.nm( dose + samp + long)
data <- as.nm( aug(dose,EVID=1, SEQ=1) + aug(samp,EVID=0, SEQ=0) | demo)
summary(data,by=c('EVID','SEQ'))
## Not run: index(data)

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