Generation of data set containing two clusters with untypical shapes (similar to waxing and waning crescent moon). For each point first random radius r
from given interval is generated then random angle alpha
and finally the coordinates of point are calculated as (a+abs(r*cos(alpha))
,r*sin(alpha)
for first shape and (-abs(r*cos(alpha))
,r*sin(alpha)-b
for second shape
shapes.two.moon(numObjects=180,shape1a=-0.4,shape2b=1,shape1rFrom=0.8,
shape1rTo=1.2,shape2rFrom=0.8, shape2rTo=1.2, outputCsv="", outputCsv2="",
outputColNames=TRUE, outputRowNames=TRUE)
cluster number for each object
generated data - matrix with objects in rows and variables in columns
number of objects in each cluster - positive integer value or vector with length=2
,
parameter a
for first shape
parameter b
for first shape
minimal value of radius for first shape
maximal value of radius for first shape
minimal value of radius for second shape
maximal value of radius for second shape
optional, name of csv file with generated data (first column contains id, second - number of cluster and others - data)
optional, name of csv (a comma as decimal point and a semicolon as field separator) file with generated data (first column contains id, second - number of cluster and others - data)
outputColNames=TRUE
indicates that output file (given by outputCsv
and outputCsv2
parameters) contains first row with column names
outputRowNames=TRUE
indicates that output file (given by outputCsv
and outputCsv2
parameters) contains a vector of row names
Marek Walesiak marek.walesiak@ue.wroc.pl, Andrzej Dudek andrzej.dudek@ue.wroc.pl
Department of Econometrics and Computer Science, University of Economics, Wroclaw, Poland
shapes.worms
,shapes.circles2
,shapes.circles3
,shapes.bulls.eye
,shapes.blocks3d
library(clusterSim)
stm<-shapes.two.moon(180)
plot(stm$data,col=rainbow(2)[stm$clusters])
Run the code above in your browser using DataLab