| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/utils.R |
| 3 |
\name{tree} |
| 4 |
\alias{tree} |
| 5 |
\title{Turn the output of \code{\link[=str]{str()}} into a tree diagram} |
| 6 |
\usage{ |
| 7 |
tree(...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{...}{Arguments to be passed to \code{\link[=str]{str()}} (note that the |
| 11 |
\code{comp.str} is hardcoded inside this function, and it is the only |
| 12 |
argument that you cannot customize).} |
| 13 |
} |
| 14 |
\value{ |
| 15 |
A character string as a \code{\link[=raw_string]{raw_string()}}. |
| 16 |
} |
| 17 |
\description{ |
| 18 |
The super useful function \code{str()} uses \verb{..} to indicate the level |
| 19 |
of sub-elements of an object, which may be difficult to read. This function |
| 20 |
uses vertical pipes to connect all sub-elements on the same level, so it is |
| 21 |
clearer which elements belong to the same parent element in an object with a |
| 22 |
nested structure (such as a nested list). |
| 23 |
} |
| 24 |
\examples{ |
| 25 |
fit = lsfit(1:9, 1:9) |
| 26 |
str(fit) |
| 27 |
xfun::tree(fit) |
| 28 |
|
| 29 |
fit = lm(dist ~ speed, data = cars) |
| 30 |
str(fit) |
| 31 |
xfun::tree(fit) |
| 32 |
|
| 33 |
# some trivial examples |
| 34 |
xfun::tree(1:10) |
| 35 |
xfun::tree(iris) |
| 36 |
} |