| 1 |
\name{str_data} |
| 2 |
\alias{str_data} |
| 3 |
\title{Overview on All Datasets in an R Package} |
| 4 |
\description{ |
| 5 |
Provide an overview over all datasets available by |
| 6 |
\code{\link{data}()} in a (list of) given \R packages. |
| 7 |
} |
| 8 |
\usage{ |
| 9 |
str_data(pkgs, filterFUN, \dots) |
| 10 |
} |
| 11 |
\arguments{ |
| 12 |
\item{pkgs}{character vector of names of \R packages.} |
| 13 |
\item{filterFUN}{optionally a \code{\link{logical}} |
| 14 |
\code{\link{function}} for filtering the \R objects.} |
| 15 |
\item{\dots}{potentical further arguments to be passed to |
| 16 |
\code{\link{str}}; \code{str(utils:::str.default)} gives useful list.} |
| 17 |
} |
| 18 |
\value{ |
| 19 |
invisibly (see \code{\link{invisible}}) a \code{\link{list}} with |
| 20 |
named components matching the \code{pkgs} argument. Each of these |
| 21 |
components is a named list with one entry per \code{data(.)} argument |
| 22 |
name. Each entry is a \code{\link{character}} vector of the names |
| 23 |
of all objects, typically only one. |
| 24 |
|
| 25 |
The side effect is, as with \code{\link{str}()}, to print |
| 26 |
everything (via \code{\link{cat}}) to the console. |
| 27 |
} |
| 28 |
\author{Martin Maechler} |
| 29 |
\seealso{\code{\link[utils]{str}}, \code{\link[utils]{data}}. |
| 30 |
} |
| 31 |
\examples{ |
| 32 |
str_data("cluster") |
| 33 |
|
| 34 |
str_data("datasets", max=0, give.attr = FALSE) |
| 35 |
|
| 36 |
## Filtering (and return value) |
| 37 |
dfl <- str_data("datasets", filterFUN=is.data.frame) |
| 38 |
str(df.d <- dfl$datasets) |
| 39 |
## dim() of all those data frames: |
| 40 |
t(sapply(unlist(df.d), function(.) dim(get(.)))) |
| 41 |
|
| 42 |
### Data sets in all attached packages but "datasets" (and stubs): |
| 43 |
s <- search() |
| 44 |
(Apkgs <- sub("^package:", '', s[grep("^package:", s)])) |
| 45 |
str_data(Apkgs[!Apkgs \%in\% c("datasets", "stats", "base")]) |
| 46 |
} |
| 47 |
\keyword{datasets} |
| 48 |
\keyword{utilities} |
| 49 |
\keyword{documentation} |
| 50 |
|