Error without an error being thrown

后端 未结 1 406
猫巷女王i
猫巷女王i 2020-12-21 06:43

I\'m trying to multiply impute some data, and it\'s failing in a very odd way. I have options(error=recover) set, and mi() doesn\'t throw an error, but it does stop imputin

相关标签:
1条回答
  • 2020-12-21 07:01

    Since the error=recover option is not working, an alternative that does work is to set options(error=dump.frames). That will get you some information about the error, which you can either print out or, more usefully, examine with debugger()

    ls()
    # [1] "dat"
    options(error=dump.frames)
    mi(dat)
    ls()
    # [1] "dat"       "last.dump"  # Apparently there WAS an error
    
    # INVESTIGATE WITH debugger()
    debugger(dump=last.dump)
    
    # ALTERNATIVELY, PRINT last.dump TO CONSOLE
    last.dump
    
    $`mi(dat)`
    <environment: 0x05155c44>
    
    $`mi(dat)`
    <environment: 0x05158f30>
    
    $`.local(object, ...)`
    <environment: 0x05158cac>
    
    $`mi.default(object, info, n.imp, n.iter, R.hat, max.minutes, rand.imp.method`
    <environment: 0x047dc3a0>
    
    attr(,"error.message")
    [1] "Error in aveVar[s, i, ] <- c(avevar.mean, avevar.sd) :
    \n  number of items to replace is not a multiple of replacement length\n"
    attr(,"class")
    [1] "dump.frames"
    
    0 讨论(0)
提交回复
热议问题