aprofWrapper: Light wrapper around the aprof function

Description Usage Arguments Value Examples

Description

Light wrapper around the aprof function

Usage

1
aprofWrapper(expr, sourceFile)

Arguments

expr

Expression to profile

sourceFile

The file with the source code to be profiled

Value

An aprof object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# The function to profile
f = function(n, sim) {
  # Simulate some data
  x = rnorm(n, mean = 0, sd = 2)
  t = data.frame(x)
  for (i in 1:sim) {
   y = x + rnorm(x, mean = 0, sd = 0.5)
    t = cbind(t, y)
  }
  return(t)
}

# Dump the function to a tmp file
mySourceFile = tempfile()
dump("f", file = mySourceFile)

# Profile
prof = aprofWrapper(f(100, 100), mySourceFile)
# Visualise
viewProfHtml(prof)

mdjbru-R-packages/aprofW documentation built on May 22, 2019, 3:37 p.m.