R Under development (unstable) (2025-06-27 r88363 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## VT::15.01.2020 - this will render the output independent > ## from the version of the package > suppressPackageStartupMessages(library(trimcluster)) > > set.seed(10001) > n1 <-60 > n2 <-60 > n3 <-70 > n0 <-10 > nn <- n1+n2+n3+n0 > pp <- 2 > X <- matrix(rep(0,nn*pp),nrow=nn) > ii <-0 > for (i in 1:n1){ + ii <-ii+1 + X[ii,] <- c(5,-5)+rnorm(2) + } > for (i in 1:n2){ + ii <- ii+1 + X[ii,] <- c(5,5)+rnorm(2)*0.75 + } > for (i in 1:n3){ + ii <- ii+1 + X[ii,] <- c(-5,-5)+rnorm(2)*0.75 + } > for (i in 1:n0){ + ii <- ii+1 + X[ii,] <- rnorm(2)*8 + } > tkm1 <- trimkmeans(X,k=3,trim=0.1,runs=3) > # runs=3 is used to save computing time. > print(tkm1) * trimmed k-means * trim= 0.1 , k= 3 Classification (trimmed points are indicated by 4 ): [1] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 3 3 3 3 3 3 3 4 3 3 3 3 3 3 3 3 3 3 [38] 3 3 3 4 3 3 3 3 3 3 3 3 4 3 3 3 3 3 3 3 3 3 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [75] 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 [112] 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [186] 1 1 1 1 1 4 4 4 4 4 4 4 4 4 4 Means: [,1] [,2] [1,] -4.948673 -4.978344 [2,] 5.125058 5.040808 [3,] 5.139695 -5.083246 Trimmed mean squares: 1.214552 > plot(tkm1,X) > > proc.time() user system elapsed 0.21 0.03 0.25