Learn R Programming

umx (version 1.3.0)

umx_time: umx_time

Description

A function to compactly report how long a model took to execute. Comes with some preset styles User can set the format with C-style string formatting.

Usage

umx_time(model = NA, formatStr = c("simple", "std", "custom %H %M %OS3"), tz = "GMT", autoRun = TRUE)

Arguments

model
An mxModel (or list of models for which to display elapsed time
formatStr
A format string, defining how to show the time (defaults to human readable)
tz
time zone in which the model was executed (defaults to "GMT")
autoRun
If TRUE (default), run the model if it appears not to have been.

Value

- invisible time string

Details

The default is "simple", which gives only the biggest unit used. i.e., "x seconds" for times under 1 minute. "std" shows time in the format adopted in OpenMx 2.0 e.g. "Wall clock time (HH:MM:SS.hh): 00:00:01.16"

If a list of models is provided, time deltas will also be reported.

If the model hasn not been run, umx_time will run it for you.

References

- http://www.github.com/tbates/umx

See Also

Other Reporting Functions: loadings.MxModel, mxSE, umxAPA, umx_APA_pval, umx_aggregate, umx_print, umx_show, umx

Examples

Run this code
require(umx)
umx_time('start')
data(demoOneFactor)
latents  = c("G")
manifests = names(demoOneFactor)
myData = mxData(cov(demoOneFactor), type = "cov", numObs = 500)
m1 <- umxRAM("One Factor", data = myData,
	umxPath(from = latents, to = manifests),
	umxPath(var = manifests),
	umxPath(var = latents, fixedAt = 1)
)
umx_time(m1)
m2 = umxRun(m1)
umx_time(c(m1, m2))
umx_time('stop')
# elapsed time: .3 seconds

Run the code above in your browser using DataLab