sourceAttach function

Source and Attach an R source file

Source and Attach an R source file

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

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.

Returns

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)
  • Maintainer: Martin Maechler
  • License: GPL (>= 2)
  • Last published: 2024-11-05