Skip to content

capture.output on S4 slot

1 message · Dario Strbenac

#
Hello,

capture.output produces a different result if the S4 object was created with a constructor than if the body of the constructor is copied and pasted.

setClass("TransformParams", representation(
  transform = "function",
  otherParams = "list")
)

setGeneric("TransformParams", function(transform, ...)
{standardGeneric("TransformParams")})
setMethod("TransformParams", character(0), function()
{
  new("TransformParams", transform = function(){}, otherParams = list())
})
[1] "function () "             "{"                       
[3] "}"                        "<environment: 0x363bd60>"
[1] "function(){}"

Why is the function split into three parts if a constructor is used ?

--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia