如果您发现包中的bug,它通常是可能需要打上fixInNamespace,例如问题fixInNamespace("mean.default", "base")

有关S4方法,我不知道如何做到这一点,虽然。我在看的方法是在gWidgetstcltk包。你可以看到的源代码与

getMethod(".svalue", c("gTabletcltk", "guiWidgetsToolkittcltk"))

我不能找到与fixInNamespace的方法。

fixInNamespace(".svalue", "gWidgetstcltk")

Error in get(subx, envir = ns, inherits = FALSE) : 
  object '.svalue' not found

我想setMethod可能做的伎俩,但

setMethod(".svalue", c("gTabletcltk", "guiWidgetsToolkittcltk"),
  definition = function (obj, toolkit, index = NULL, drop = NULL, ...) 
  {
      widget = getWidget(obj)
      sel <- unlist(strsplit(tclvalue(tcl(widget, "selection")), 
          " "))
      if (length(sel) == 0) {
          return(NA)
      }
      theChildren <- .allChildren(widget)
      indices <- sapply(sel, function(i) match(i, theChildren))
      inds <- which(visible(obj))[indices]
      if (!is.null(index) && index == TRUE) {
          return(inds)
      }
      if (missing(drop) || is.null(drop)) 
          drop = TRUE
      chosencol <- tag(obj, "chosencol")
      if (drop) 
          return(obj[inds, chosencol, drop = drop])
      else return(obj[inds, ])
  },
  where = "package:gWidgetstcltk"  
)

Error in setMethod(".svalue", c("gTabletcltk", "guiWidgetsToolkittcltk"),  : 
  the environment "gWidgetstcltk" is locked; cannot assign methods for function ".svalue"

任何想法?

有帮助吗?

解决方案

如何获得源,应用的变化和重建的老派的方式?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top