| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/cut_lower_fun.R |
| 3 |
\name{cut_lower_fun} |
| 4 |
\alias{cut_lower_fun} |
| 5 |
\alias{dendextend_cut_lower_fun} |
| 6 |
\title{Cut a dendrogram - and run a function on the output} |
| 7 |
\usage{ |
| 8 |
cut_lower_fun(dend, h, FUN = labels, warn = dendextend_options("warn"), ...) |
| 9 |
} |
| 10 |
\arguments{ |
| 11 |
\item{dend}{a dendrogram object.} |
| 12 |
|
| 13 |
\item{h}{a scalar of height to cut the dend by.} |
| 14 |
|
| 15 |
\item{FUN}{a function to run. (default is "labels")} |
| 16 |
|
| 17 |
\item{warn}{logical (default from dendextend_options("warn") is FALSE). |
| 18 |
Set if warning are to be issued, it is safer to keep this at TRUE, |
| 19 |
but for keeping the noise down, the default is FALSE. |
| 20 |
Should the user be warned if reverting to default?} |
| 21 |
|
| 22 |
\item{...}{passed to FUN.} |
| 23 |
} |
| 24 |
\value{ |
| 25 |
A list with the output of running FUN on each of the |
| 26 |
sub dends derived from cutting "dend" |
| 27 |
} |
| 28 |
\description{ |
| 29 |
Cuts the dend at height h and returns a list with the FUN function |
| 30 |
implemented on all the sub trees created by cut at height h. |
| 31 |
This is used for creating a \link[dendextend]{cutree.dendrogram} function, |
| 32 |
by using the \code{labels} function as FUN. |
| 33 |
|
| 34 |
This is the Rcpp version of the function, offering a 10-60 times improvement |
| 35 |
in speed (depending on the tree size it is used on). |
| 36 |
} |
| 37 |
\examples{ |
| 38 |
|
| 39 |
dend <- as.dendrogram(hclust(dist(iris[1:4, -5]))) |
| 40 |
# this is really cool! |
| 41 |
cut_lower_fun(dend, .4, labels) |
| 42 |
lapply(cut(dend, h = .4)$lower, labels) |
| 43 |
cut_lower_fun(dend, .4, order.dendrogram) |
| 44 |
|
| 45 |
} |
| 46 |
\seealso{ |
| 47 |
\code{\link{labels}}, \code{\link{dendrogram}}, |
| 48 |
\link[dendextend]{cutree.dendrogram} |
| 49 |
} |
| 50 |
\author{ |
| 51 |
Tal Galili |
| 52 |
} |