1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Do not modify this file since it was automatically generated from:
%
% attachLocally.R
%
% by the Rdoc compiler part of the R.oo package.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\name{attachLocally.list}
\alias{attachLocally.list}
\alias{attachLocally.data.frame}
\alias{attachLocally.environment}
\alias{attachLocally}
\title{Assigns an objects elements locally}
\usage{
\method{attachLocally}{list}(object, fields=NULL, excludeFields=NULL, overwrite=TRUE,
envir=parent.frame(), ...)
}
\description{
Assigns an objects elements locally.
}
\arguments{
\item{object}{An object with named elements such as an \code{\link[base]{environment}},
a \code{\link[base]{list}}, or a \code{\link[base]{data.frame}}.}
\item{fields}{A \code{\link[base]{character}} \code{\link[base]{vector}} specifying elements to be copied.
If \code{\link[base]{NULL}}, all elements are considered.}
\item{excludeFields}{A \code{\link[base]{character}} \code{\link[base]{vector}} specifying elements not to
be copied. This has higher priority than \code{fields}.}
\item{overwrite}{If \code{\link[base:logical]{FALSE}}, fields that already exists will not be
copied.}
\item{envir}{The \code{\link[base]{environment}} where elements are copied to.}
\item{...}{Not used.}
}
\value{
Returns (invisibly) a \code{\link[base]{character}} \code{\link[base]{vector}} of the fields copied.
}
\examples{
foo <- function(object) {
cat("Local objects in foo():\n")
print(ls())
attachLocally(object)
cat("\nLocal objects in foo():\n")
print(ls())
for (name in ls()) {
cat("\nObject '", name, "':\n", sep="")
print(get(name, inherits=FALSE))
}
}
a <- "A string"
l <- list(a=1:10, msg="Hello world", df=data.frame(a=NA, b=2))
foo(l)
print(a)
}
\author{Henrik Bengtsson}
\seealso{
\code{\link[R.oo:attachLocally.Object]{attachLocally}()} of class Object.
\code{\link[base]{attach}}().
}
\keyword{methods}
\keyword{utilities}
\keyword{programming}
|