sourceAttach: Source and Attach an R source file

View source: R/sourceAttach.R

sourceAttachR Documentation

Source and Attach an R source file

Description

Source (via sys.source()) and attach (attach) an R source file.

Usage

sourceAttach(file, pos=2,
             name = paste(abbreviate(gsub(fsep,"", dirname(file)),
                                     12, method="both.sides"),
                          basename(file), sep=fsep),
             keep.source = getOption("keep.source.pkgs"),
             warn.conflicts = TRUE)

Arguments

file

file name

pos

passed to attach()

name

character, with a smart default, passed to attach().

keep.source

logical, see sys.source().

warn.conflicts

logical, see attach.

Value

the return value of attach().

Author(s)

Martin Maechler, 29 Jul 2011

See Also

attach, sys.source, source

Examples

 sourceAttach(system.file("test-tools-1.R", package="Matrix", mustWork=TRUE))
 search() # shows the new "data base" at position 2
 ## look what it contains:
 ls.str(pos = 2)

sfsmisc documentation built on Sept. 11, 2024, 6:53 p.m.