traceback()

> exampleSum <- function(x, y) {
+   x <- x+1
+   return(x+y)
+ }

> debug(exampleSum)             # set debug flag
> exampleSum(1, 2)              # run function in browser mode
debugging in: exampleSum(1, 2)
debug: {
    x <- x + 1
    return(x + y)
}
Browse[2]> n                    # next step
debug: x <- x + 1
Browse[2]> ls()                 # show objects
[1] "x" "y"
Browse[2]> x                    # show x
[1] 1
Browse[2]> c                    # run function to end
exiting from: exampleSum(1, 2)
[1] 4

> undebug(exampleSum)           # remove debug flag

你可能感兴趣的:(1024程序员节)