나는이 오류를 유발하고 사용하는 모든 프레임의 덤프를 기록 다음 코드 dump.frames()
proposed e. g. by Hadley Wickham 등 :R :) (dump.frames을 디버거() 나중에 사후 디버깅을위한 모든 변수를 포함하는 방법
a <- -1
b <- "Hello world!"
bad.function <- function(value)
{
log(value) # the log function may cause an error or warning depending on the value
}
tryCatch({
a.local.value <- 42
bad.function(a)
bad.function(b)
},
error = function(e)
{
dump.frames(to.file = TRUE)
})
나는 R 세션을 다시 시작하고 내 변수 (A, B, a.local.value)도 어디서나 내 기능 "bad.function"를 찾을 수 없습니다
load(file = "last.dump.rda")
debugger(last.dump)
를 통해 문제를 디버깅 할 덤프를로드 할 때 프레임에.
이렇게하면 덤프가 거의 쓸모 없게됩니다.
내 모든 변수와 기능을 알기 위해해야 할 일 부검 분석?
debugger
의 출력은 :
> load(file = "last.dump.rda")
> debugger(last.dump)
Message: non-numeric argument to mathematical functionAvailable environments had calls:
1: tryCatch({
a.local.value <- 42
bad.function(a)
bad.function(b)
2: tryCatchList(expr, classes, parentenv, handlers)
3: tryCatchOne(expr, names, parentenv, handlers[[1]])
4: value[[3]](cond)
Enter an environment number, or 0 to exit
Selection:
PS : 나는 디버깅 RStudio R3.3.2으로 사용하고 있습니다.
선택 한 다음 할'의 LS (parentenv)'또는'수 ("a.local.value", ENV = parentenv) '을 참조하십시오. –
스트라이크, 지역 변수를 얻는 것은 그런 식으로 작동합니다. 덤프의 다른 프레임에 포함 된 모든 환경을 탐색 할 때 찾을 수없는 것은 전역 변수와 함수입니다. 이상하게 ...'.GlobalEnv'는'dump.frames'에 포함되지 않은 것처럼 보입니다. –
아마도 덤프 된 .rda 파일에 추가 변수를 추가 할 수 있습니까? –