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

vegclust2kmeans(x)

Arguments

x

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

Author

Miquel De Cáceres, CREAF

See also

Examples

## 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
#> K-means clustering with 3 clusters of sizes 17, 10, 14
#> 
#> Cluster means:
#>       Abefic     Merhed     Alyvag     Pancam     Abemos     Melcor     Ludoct
#> 1 0.00000000 0.00000000 0.00000000 0.02725749 0.00000000 0.06157316 0.00000000
#> 2 0.01825742 0.06770211 0.00000000 0.35635911 0.01458650 0.27504998 0.01889822
#> 3 0.00000000 0.00000000 0.04696958 0.07606533 0.01558699 0.15317754 0.00000000
#>       Eupvac     Echpas     Passcr       Poa2     Carhal     Dendio     Casobt
#> 1 0.03879374 0.04762643 0.00000000 0.00000000 0.03679444 0.01572125 0.01631471
#> 2 0.20498936 0.10174214 0.02581989 0.00000000 0.00000000 0.00000000 0.00000000
#> 3 0.05023873 0.06646064 0.00000000 0.01041893 0.06911470 0.00000000 0.00000000
#>       Aesind     Cyprot     Ipocop     Cynarc     Walind    Sessp.     Phynod
#> 1 0.00000000 0.00000000 0.00000000 0.00000000 0.06827998 0.1437923 0.00000000
#> 2 0.01889822 0.17597447 0.03974967 0.43238581 0.07754611 0.1569788 0.06361634
#> 3 0.07475403 0.08126971 0.01262691 0.01262691 0.06377158 0.1041481 0.71534308
#>      Echell     Helind     Ipoaqu    Orysp.    Elesp.     Psespi   Ludads
#> 1 0.0491431 0.12531919 0.05532759 0.6491987 0.1535492 0.19245622 0.204177
#> 2 0.1120500 0.01889822 0.03657589 0.0400000 0.0000000 0.00000000 0.000000
#> 3 0.1191200 0.17218890 0.04775048 0.1720463 0.1377765 0.02691262 0.000000
#>       Polatt       Poa1     Helcri     Physp.     Goopur
#> 1 0.09678166 0.00000000 0.00000000 0.01153624 0.01153624
#> 2 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
#> 3 0.00000000 0.01282895 0.01282895 0.00000000 0.00000000
#> 
#> Clustering vector:
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 2 2 2 2 3 3 3 2 2 2 2 2
#> [39] 2 1 1
#> 
#> Within cluster sum of squares by cluster:
#> [1] 6.968455 4.684155 4.502115
#> 
#> Available components:
#> 
#> [1] "cluster"      "centers"      "totss"        "withinss"     "tot.withinss"
#> [6] "betweenss"    "size"         "iter"         "ifault"