trace
doesn't seem to work correctly inside precompiled functions
For example, in this fragment
xx <- 2:7
nu <- seq(-10, 9, length.out = 2001)
op <- par(lab = c(16, 5, 7))
matplot(nu, t(outer(xx, nu, besselI)), type = "l", ylim = c(-50, 200),
main = expression(paste("Bessel ", I[nu](x), " for fixed ", x,
", as ", f(nu))),
xlab = expression(nu))
Simple trace
to xy.coords
work fine
trace(xy.coords)
matplot(nu, t(outer(xx, nu, besselI)), type = "l", ylim = c(-50, 200),
main = expression(paste("Bessel ", I[nu](x), " for fixed ", x,
", as ", f(nu))),
xlab = expression(nu))
But tracing with the function does not work
trace(xy.coords, tracer = quote(cat("test\n")))
# Tracing function "xy.coords" in package "grDevices"
# [1] "xy.coords"
matplot(nu, t(outer(xx, nu, besselI)), type = "l", ylim = c(-50, 200),
main = expression(paste("Bessel ", I[nu](x), " for fixed ", x,
", as ", f(nu))),
xlab = expression(nu))
While direct calling works fine
xy.coords(1:3, 1:2, recycle = TRUE)
# Tracing xy.coords(1:3, 1:2, recycle = TRUE) on entry
# test
# $x
# [1] 1 2 3
#
# $y
# [1] 1 2 1
#
# $xlab
# NULL
#
# $ylab
# NULL
What is happening and what do I need to change?
Refresh . I will disable compilation of packages grDevices
and others base
, but trace
still not working correctly. When debugging matplot
, xy.coords
it turns out to be without tracing.
Update 2 . This is similar to Overriding a function imported in a namespace , but after you have tried everything with a traced object proposed in the namespace, the old one is still called.