[Rd] capture.output on S4 slot
Dario Strbenac
dstr7320 at uni.sydney.edu.au
Fri Jul 18 06:00:08 CEST 2014
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
More information about the R-devel
mailing list