include {memisc} | R Documentation |
Attach a Source File to the Search Path
Description
Functions include
and uninclude
provide a simple mechanism
for modularisation without the need to code a full-blown package.
Functions in an include
d sourcefile are attached to the search path,
but are not visible in the global environment. If an experienced user
has written quite a number of utility functions for her/his daily work,
but does not want to have listed them in each ls()
call,
s/he can just include
a source file containing these utility
functions. uninclude
just reverts the attachment of a source file
into the search path. detach.sources
detaches all
source files from the search path.
Usage
include(filename,warn=FALSE)
uninclude(filename)
detach.sources()
Arguments
filename |
character string, path to a file containing R code. |
warn |
logical value; should a warning issued if the file
has already been include d? |
Examples
## Not run:
include("~/R/my-functions.R")
include("~/R/more-of-my-functions.R")
ls() # The functions defined in these files will not show up here
# ... but here
search()
ls("source:~/R/my-functions.R")
ls("source:~/R/more-of-my-functions.R")
z <- one.of.my.functions(100) # ... and are available.
uninclude("~/R/my-functions.R")
detach.sources()
## End(Not run)
[Package
memisc version 0.95-17
Index]