The R Project SVN R

Rev

Rev 42421 | Rev 56184 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 42421 Rev 43745
Line 5... Line 5...
5
 
5
 
6
\name{method.skeleton}
6
\name{method.skeleton}
7
\alias{method.skeleton}
7
\alias{method.skeleton}
8
\title{Create a Skeleton File for a New Method}
8
\title{Create a Skeleton File for a New Method}
9
\description{
9
\description{
10
  This function writes a source file containing a call to \code{\link{setMethod}} to define a method
10
  This function writes a source file containing a call to
11
  for the generic function and signature supplied.  By default the
11
  \code{\link{setMethod}} to define a method for the generic function
12
  method definition is in line in the call, but can be made an
12
  and signature supplied.  By default the method definition is in line
13
  external function assigned in the same source file.
13
  in the call, but can be made an external (previously assigned) function.
14
}
14
}
15
\usage{
15
\usage{
16
method.skeleton(generic, signature, file, external = FALSE, where)
16
method.skeleton(generic, signature, file, external = FALSE, where)
17
}
17
}
18
\arguments{
18
\arguments{
Line 40... Line 40...
40
    the top-level environment of the call to \code{method.skeleton}.}
40
    the top-level environment of the call to \code{method.skeleton}.}
41
}
41
}
42
\value{
42
\value{
43
  The \code{file} argument, invisibly, but the function is used for its side effect.
43
  The \code{file} argument, invisibly, but the function is used for its side effect.
44
}
44
}
45
\seealso{ \code{\link{setMethod}}, \code{\link{package.skeleton}}}
45
\seealso{\code{\link{setMethod}}, \code{\link{package.skeleton}}
-
 
46
}
46
\examples{
47
\examples{
47
\dontrun{
48
\dontshow{oWD <- setwd(tempdir())}
48
setClass("track", representation(x ="numeric", y="numeric"))
49
setClass("track", representation(x ="numeric", y="numeric"))
49
method.skeleton("show", "track")  ## writes show_track.R
50
method.skeleton("show", "track")            ## writes show_track.R
50
method.skeleton("Ops", c("track", "track")) ##writes "Ops_track_track.R"
51
method.skeleton("Ops", c("track", "track")) ## writes "Ops_track_track.R"
-
 
52
 
51
## write multiple method skeletons to one file
53
## write multiple method skeletons to one file
52
con = file("./Math_track.R", "w")
54
con <- file("./Math_track.R", "w")
53
method.skeleton("Math", "track", con)
55
method.skeleton("Math", "track", con)
54
method.skeleton("exp", "track", con)
56
method.skeleton("exp", "track", con)
55
method.skeleton("log", "track", con)
57
method.skeleton("log", "track", con)
56
close(con)
58
close(con)
57
}
59
\dontshow{setwd(oWD)}
58
}
60
}
59
\keyword{programming}
61
\keyword{programming}
60
\keyword{methods}
62
\keyword{methods}