| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/labels.R |
| 3 |
\name{order.dendrogram<-} |
| 4 |
\alias{order.dendrogram<-} |
| 5 |
\title{order.dendrogram<- assignment operator} |
| 6 |
\usage{ |
| 7 |
order.dendrogram(object, ...) <- value |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{object}{a variable name (possibly quoted) who's label are to be updated} |
| 11 |
|
| 12 |
\item{...}{parameters passed (not currently in use)} |
| 13 |
|
| 14 |
\item{value}{a value to be assigned to object's leaves value (their "order")} |
| 15 |
} |
| 16 |
\value{ |
| 17 |
dendrogram with updated order leaves values |
| 18 |
} |
| 19 |
\description{ |
| 20 |
order.dendrogram<- assignment operator. This is useful in cases where some object is turned into a dendrogram but its leaves values (the order) are all mixed up. |
| 21 |
} |
| 22 |
\examples{ |
| 23 |
################ |
| 24 |
# Example for using the assignment with dendrogram and hclust objects: |
| 25 |
hc <- hclust(dist(USArrests[1:4, ]), "ave") |
| 26 |
dend <- as.dendrogram(hc) |
| 27 |
|
| 28 |
str(dend) |
| 29 |
order.dendrogram(dend) # 4 3 1 2 |
| 30 |
order.dendrogram(dend) <- 1:4 |
| 31 |
order.dendrogram(dend) # 1 2 3 4 |
| 32 |
str(dend) # the structure is still fine. |
| 33 |
|
| 34 |
# This function is very useful if we try playing with subtrees |
| 35 |
# For example: |
| 36 |
hc <- hclust(dist(USArrests[1:6, ]), "ave") |
| 37 |
dend <- as.dendrogram(hc) |
| 38 |
sub_dend <- dend[[1]] |
| 39 |
order.dendrogram(sub_dend) # 4 6 |
| 40 |
# now using as.hclust(sub_dend) will cause trouble: |
| 41 |
# labels(as.hclust(sub_dend)) # As of R 3.1.1-patched - this will produce an Error (as it should) :) |
| 42 |
# let's fix it: |
| 43 |
|
| 44 |
order.dendrogram(sub_dend) <- rank(order.dendrogram(sub_dend), ties.method = "first") |
| 45 |
labels(as.hclust(sub_dend)) # We now have labels :) |
| 46 |
} |
| 47 |
\seealso{ |
| 48 |
\code{\link{order.dendrogram}}, \code{\link{labels<-}} |
| 49 |
} |