| 1 |
\name{sourceAttach} |
| 2 |
\alias{sourceAttach} |
| 3 |
\title{Source and Attach an R source file} |
| 4 |
\description{ |
| 5 |
Source (via \code{\link{sys.source}()}) and attach |
| 6 |
(\code{\link{attach}}) an \R source file. |
| 7 |
} |
| 8 |
\usage{ |
| 9 |
sourceAttach(file, pos=2, |
| 10 |
name = paste(abbreviate(gsub(fsep,"", dirname(file)), |
| 11 |
12, method="both.sides"), |
| 12 |
basename(file), sep=fsep), |
| 13 |
keep.source = getOption("keep.source.pkgs"), |
| 14 |
warn.conflicts = TRUE) |
| 15 |
} |
| 16 |
\arguments{ |
| 17 |
\item{file}{file name} |
| 18 |
\item{pos}{passed to \code{\link{attach}()}} |
| 19 |
\item{name}{character, with a smart default, passed to \code{attach()}.} |
| 20 |
\item{keep.source}{logical, see \code{\link{sys.source}()}.} |
| 21 |
\item{warn.conflicts}{logical, see \code{\link{attach}}.} |
| 22 |
} |
| 23 |
\value{ |
| 24 |
the return value of \code{\link{attach}()}. |
| 25 |
} |
| 26 |
\author{Martin Maechler, 29 Jul 2011} |
| 27 |
\seealso{ |
| 28 |
\code{\link{attach}}, \code{\link{sys.source}}, \code{\link{source}} |
| 29 |
} |
| 30 |
\examples{ |
| 31 |
sourceAttach(system.file("test-tools-1.R", package="Matrix", mustWork=TRUE)) |
| 32 |
search() # shows the new "data base" at position 2 |
| 33 |
## look what it contains: |
| 34 |
ls.str(pos = 2) |
| 35 |
} |
| 36 |
\keyword{file} |
| 37 |
\keyword{utilities} |