setMethod
to define a method for the generic function
and signature supplied. By default the method definition is in line
in the call, but can be made an external (previously assigned) function.
method.skeleton(generic, signature, file, external = FALSE, where)
setMethod
.setMethod
".R"
. setMethod
.
If supplied as a character string, this will be used as the name
for the external function; by default the name concatenates the
generic and signature names, with separating underscores.method.skeleton
.file
argument, invisibly, but the function is used for its side effect.
setMethod
, package.skeleton
setClass("track", representation(x ="numeric", y="numeric"))
method.skeleton("show", "track") ## writes show_track.R
method.skeleton("Ops", c("track", "track")) ## writes "Ops_track_track.R"
## write multiple method skeletons to one file
con <- file("./Math_track.R", "w")
method.skeleton("Math", "track", con)
method.skeleton("exp", "track", con)
method.skeleton("log", "track", con)
close(con)
Run the code above in your browser using DataLab