Produce Prototype of an R Documentation File
Facilitate the constructing of files documenting R objects.
prompt(object, filename = NULL, name = NULL, ...)"prompt"(object, filename = NULL, name = NULL, force.function = FALSE, ...)"prompt"(object, filename = NULL, name = NULL, ...)promptImport(object, filename = NULL, name = NULL, importedFrom = NULL, importPage = name, ...)
- an R object, typically a function for the default
method. Can be
- usually, a connection or a character string giving the
name of the file to which the documentation shell should be written.
The default corresponds to a file whose name is
".Rd". Can also be
- a character string specifying the name of the object.
- a logical. If
objectas function in any case.
- further arguments passed to or from other methods.
- a character string naming the package from
objectwas imported. Defaults to the environment of
objectis a function.
- a character string naming the help page
in the package from which
NA, a documentation shell for
object is written to the file specified by
a message about this is given. For function objects, this shell
contains the proper function and argument names. R documentation
files thus created still need to be edited and moved into the
man subdirectory of the package containing the object to be
NA, a list-style representation of the
documentation shell is created and returned. Writing the shell to a
file amounts to
cat(unlist(x), file = filename, sep = "\n"),
x is the list-style representation.
prompt is used in
for loops or scripts, the
name specification will be useful.
importPage argument for
promptImport needs to give
the base of the name of the
help file of the original help page. For example,
approx function is documented in approxfun.Rd
in the stats package, so if it were imported and re-exported
it should have
importPage = "approxfun".
Objects that are imported from other packages are not
normally documented unless re-exported.
NA, a list-style representation of the documentation shell. Otherwise, the name of the file written to is returned invisibly.
The documentation file produced by
prompt.data.frame does not
have the same format as many of the data frame documentation files in
the base package. We are trying to settle on a preferred
format for the documentation.
The default filename may not be a valid filename under limited file
systems (e.g., those on Windows). Currently, calling
prompt on a non-function object assumes that
the object is in fact a data set and hence documents it as such. This
may change in future versions of R. Use
create documentation skeletons for data sets.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
For creation of many help pages (for a package),
To prompt the user for input, see
require(graphics) prompt(plot.default) prompt(interactive, force.function = TRUE) unlink("plot.default.Rd") unlink("interactive.Rd") prompt(women) # data.frame unlink("women.Rd") prompt(sunspots) # non-data.frame data unlink("sunspots.Rd") ## Not run: # ## Create a help file for each function in the .GlobalEnv: # for(f in ls()) if(is.function(get(f))) prompt(name = f) # ## End(Not run)