The R Project SVN R

Rev

Rev 59340 | Rev 64657 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 59340 Rev 61160
Line 33... Line 33...
33
\seealso{
33
\seealso{
34
  \code{\link{hclust}}, and from package \CRANpkg{cluster},
34
  \code{\link{hclust}}, and from package \CRANpkg{cluster},
35
  \code{\link[cluster]{diana}} and \code{\link[cluster]{agnes}}
35
  \code{\link[cluster]{diana}} and \code{\link[cluster]{agnes}}
36
}
36
}
37
\examples{
37
\examples{
38
x <- matrix(rnorm(30), ncol=3)
38
x <- matrix(rnorm(30), ncol = 3)
39
hc <- hclust(dist(x), method="complete")
39
hc <- hclust(dist(x), method = "complete")
40
 
40
 
41
% .srch <- search()
41
% .srch <- search()
42
if(require("cluster", quietly=TRUE)) {# is a recommended package
42
if(require("cluster", quietly = TRUE)) {# is a recommended package
43
  ag <- agnes(x, method="complete")
43
  ag <- agnes(x, method = "complete")
44
  hcag <- as.hclust(ag)
44
  hcag <- as.hclust(ag)
45
  ## The dendrograms order slightly differently:
45
  ## The dendrograms order slightly differently:
46
  op <- par(mfrow=c(1,2))
46
  op <- par(mfrow = c(1,2))
47
  plot(hc) ;  mtext("hclust", side=1)
47
  plot(hc) ;  mtext("hclust", side = 1)
48
  plot(hcag); mtext("agnes",  side=1)
48
  plot(hcag); mtext("agnes",  side = 1)
49
%  if(!any("package:cluster" == .srch)) detach("package:cluster")
49
%  if(!any("package:cluster" == .srch)) detach("package:cluster")
50
}
50
}
51
}
51
}
52
\keyword{multivariate}
52
\keyword{multivariate}
53
\keyword{cluster}
53
\keyword{cluster}