S4 objects, generics and methods don't appear in file TOC window

Consider the following small hunk of code using S4 objects.

afun <- function() {}

Obj <- setObject("Obj",slots(val=numeric))

setGeneric("getVal", function(o) standardGeneric("getVal"))

setGeneric("getVal<-", function(o,value) standardGeneric("getVal<-"))

setMethod("getVal","Obj", function(o) o@val)

setMethod("getVal<-", "Obj", function(o,value) {
  o@val <- as.numeric(value)

incVal <- function (o, inc) {
  getVal(o) <- getVal(o) + inc

If I open this in a window in R Studio, and press the TOC button (next to the source button), I only see afun and incVal listsed. I don't see Obj, getVal, getVal<- or any of the methods. It would be nice if I could see methods, generics and objects and not just the regular functions.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.