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())
})

> capture.output(TransformParams()@transform)
[1] "function () "             "{"                       
[3] "}"                        "<environment: 0x363bd60>"
> capture.output(new("TransformParams", transform = function(){}, otherParams = 
> list())@transform)
[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
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to