prompt(object, filename = NULL, name = NULL, ...)## S3 method for class 'default':
prompt(object, filename = NULL, name = NULL,
force.function = FALSE, \dots)
## S3 method for class 'data.frame':
prompt(object, filename = NULL, name = NULL, \dots)
promptImport(object, filename = NULL, name = NULL,
importedFrom = NULL, importPage = name, ...)
missing when name is specified.name followed
by ".Rd". Can also be NA (see below).TRUE, treat object
as function in any case.object was imported. Defaults to the environment
of object if object is a function.object was imported.filename is NA, a list-style representation of the
documentation shell. Otherwise, the name of the file written to is
returned invisibly. 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 promptData to
create documentation skeletons for data sets.
filename is NA, a documentation shell for
object is written to the file specified by filename, and
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
If filename is 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"),
where x is the list-style representation.
When prompt is used in for loops or scripts, the
explicit name specification will be useful.
The importPage argument for promptImport needs to give
the base of the name of the
help file of the original help page. For example,
the approx function is documented in importPage = "approxfun".
Objects that are imported from other packages are not
normally documented unless re-exported.
promptData, help and the chapter on
For creation of many help pages (for a package),
see package.skeleton.
To prompt the user for input, see readline.
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")
## Create a help file for each function in the .GlobalEnv:
for(f in ls()) if(is.function(get(f))) prompt(name = f)Run the code above in your browser using DataLab