Learn R Programming

KODAMA (version 0.0.1)

spirals: Spirals Data Set Generator

Description

Produce a data set of spiral clusters.

Usage

spirals(n=c(100,100,100),sd=c(0,0,0))

Arguments

n
a vector of integer. The lenght of the vector is the number of clusters and each number corrisponds to the number of data points in each cluster.
sd
amount of noise for each spiral.

Value

The function returns a two dimensional data set.

References

Cacciatore S, Luchinat C, Tenori L. Knowledge discovery by accuracy maximization. Proc Natl Acad Sci U S A 2014;111(14):5117-22.

See Also

helicoid,dinisurface,swissroll

Examples

Run this code
par(mfrow=c(2,2))
v1=spirals(c(100,100,100),c(0.1,0.1,0.1))
plot(v1,col=rep(2:4,each=100))
v2=spirals(c(100,100,100),c(0.1,0.2,0.3))
plot(v2,col=rep(2:4,each=100))
v3=spirals(c(100,100,100,100,100),c(0,0,0.2,0,0))
plot(v3,col=rep(2:6,each=100)) 
v4=spirals(c(20,40,60,80,100),c(0.1,0.1,0.1,0.1,0.1))
plot(v4,col=rep(2:6,c(20,40,60,80,100)))

Run the code above in your browser using DataLab