vegclust2kmeans: Reshapes as kmeans object

Description Usage Arguments Author(s) See Also Examples

View source: R/vegclust2kmeans.R

Description

This function casts an object of class vegclust into an object of class kmeans.

Usage

1

Arguments

x

An object of class vegclust to be casted, where method="KM" and mode="raw".

Author(s)

Miquel De Cáceres, Forest Science Center of Catalonia

See Also

vegclust, kmeans

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Loads data  
data(wetland)
  
## This equals the chord transformation 
## (see also  \code{\link{decostand}} in package vegan)
wetland.chord = as.data.frame(sweep(as.matrix(wetland), 1, 
                              sqrt(rowSums(as.matrix(wetland)^2)), "/"))

## Create noise clustering with 3 clusters. Perform 10 starts from random seeds 
wetland.vc = vegclust(wetland.chord, mobileCenters=3, 
                      method="KM", nstart=10)

## Reshapes as kmeans object
wetland.km = vegclust2kmeans(wetland.vc)
wetland.km

Example output

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-3
K-means clustering with 3 clusters of sizes 14, 17, 10

Cluster means:
      Abefic     Merhed     Alyvag     Pancam     Abemos     Melcor     Ludoct
1 0.00000000 0.00000000 0.04696958 0.07606533 0.01558699 0.15317754 0.00000000
2 0.00000000 0.00000000 0.00000000 0.02725749 0.00000000 0.06157316 0.00000000
3 0.01825742 0.06770211 0.00000000 0.35635911 0.01458650 0.27504998 0.01889822
      Eupvac     Echpas     Passcr       Poa2     Carhal     Dendio     Casobt
1 0.05023873 0.06646064 0.00000000 0.01041893 0.06911470 0.00000000 0.00000000
2 0.03879374 0.04762643 0.00000000 0.00000000 0.03679444 0.01572125 0.01631471
3 0.20498936 0.10174214 0.02581989 0.00000000 0.00000000 0.00000000 0.00000000
      Aesind     Cyprot     Ipocop     Cynarc     Walind    Sessp.     Phynod
1 0.07475403 0.08126971 0.01262691 0.01262691 0.06377158 0.1041481 0.71534308
2 0.00000000 0.00000000 0.00000000 0.00000000 0.06827998 0.1437923 0.00000000
3 0.01889822 0.17597447 0.03974967 0.43238581 0.07754611 0.1569788 0.06361634
     Echell     Helind     Ipoaqu    Orysp.    Elesp.     Psespi   Ludads
1 0.1191200 0.17218890 0.04775048 0.1720463 0.1377765 0.02691262 0.000000
2 0.0491431 0.12531919 0.05532759 0.6491987 0.1535492 0.19245622 0.204177
3 0.1120500 0.01889822 0.03657589 0.0400000 0.0000000 0.00000000 0.000000
      Polatt       Poa1     Helcri     Physp.     Goopur
1 0.00000000 0.01282895 0.01282895 0.00000000 0.00000000
2 0.09678166 0.00000000 0.00000000 0.01153624 0.01153624
3 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000

Clustering vector:
 [1] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 1 1 1 3 3 3 3 3
[39] 3 2 2

Within cluster sum of squares by cluster:
[1] 4.502115 6.968455 4.684155

Available components:

[1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
[6] "betweenss"    "size"         "iter"         "ifault"      

vegclust documentation built on May 29, 2018, 9:04 a.m.