
82 R Programming for Bioinformatics
> fun.Foo = function(x, ...) print(ls(all = TRUE))
> y = 1
> class(y) = c("Foo", "Zip", "Zoom")
> fun(y)
[1] "..." ".Class"
[3] ".Generic" ".GenericCallEnv"
[5] ".GenericDefEnv" ".Method"
[7] "x"
We examine three of these special variables in a bit more detail in the code
example below. They are .Class, .Generic and .Method; all special variables
are documented and you may make use of them in your code if you wish or
need to – but be careful.
> fun.Foo = function(x, ...) {
+ print(paste(".Generic =", .Generic))
+ print(paste(".Class =", paste(.Class,
+ collapse = ", ")))
+ print(paste(".Method =", .Method))
+ }
> fun(y)
[1]