[R] debug only top level function

PIKAL Petr petr@p|k@| @end|ng |rom prechez@@cz
Thu Jun 6 10:55:02 CEST 2019


Dear all

I have a question about debug function. I did not use it for long time but my vague memory tell me, that when I used  debug(myfunction) in past, only myfunction was debugged and browser ignored any embedded function.

example (simple)

fff <- function(x) mean(x, na.rm=T)

when I issue
> debug(fff)
> fff(1:10)
debugging in: fff(1:10)
debug at #1: mean(x, na.rm = T)
Browse[2]>
debugging in: mean(x, na.rm = T)
debug: UseMethod("mean")
Browse[3]>
debugging in: mean.default(x, na.rm = T)
...
it starts debugging mean function. I understand that it is indicated by Browse[n] but it could be quite messy if I have many embedded functions and difficult to follow.

Can I persuade debug function not to bother with embedded functions (e.g. mean, median, mad, ...) and debug only my top level code?

Best regards
Petr

> sessionInfo()
R Under development (unstable) (2018-03-07 r74369)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=Czech_Czechia.1250  LC_CTYPE=Czech_Czechia.1250
[3] LC_MONETARY=Czech_Czechia.1250 LC_NUMERIC=C
[5] LC_TIME=Czech_Czechia.1250

attached base packages:
[1] stats     datasets  utils     grDevices graphics  methods   base

other attached packages:
[1] MASS_7.3-49     readxl_1.0.0    lattice_0.20-35 fun_0.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.16     cellranger_1.1.0 grid_3.5.0       plyr_1.8.4
 [5] gtable_0.2.0     scales_0.5.0     ggplot2_2.2.1    pillar_1.2.1
 [9] rlang_0.2.0      lazyeval_0.2.1   rpart_4.1-13     tools_3.5.0
[13] munsell_0.4.3    compiler_3.5.0   colorspace_1.3-2 tibble_1.4.2
>
Osobn? ?daje: Informace o zpracov?n? a ochran? osobn?ch ?daj? obchodn?ch partner? PRECHEZA a.s. jsou zve?ejn?ny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner's personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
D?v?rnost: Tento e-mail a jak?koliv k n?mu p?ipojen? dokumenty jsou d?v?rn? a podl?haj? tomuto pr?vn? z?vazn?mu prohl??en? o vylou?en? odpov?dnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/


	[[alternative HTML version deleted]]



More information about the R-help mailing list