Wednesday, July 13, 2011

Checkout my new package on Clustering at CRAN

Modalclust: Hierarchical Modal Clustering

Perfroms Modal Clustering (MAC) including Hierarchical Modal Clustering (HMAC) along with their parallel implementation (PHMAC) over several processors. These model-based non-parametric clustering techniques can extract clusters in very high dimensions with arbitrary density shapes. By default clustering is performed over several resolutions and the results are summarized as a hierarchical tree. Associated plot functions are also provided. There is a package vignette that provides many examples.

Version: 0.2
Depends: R (≥ 1.8.0), mvtnorm, zoo, class
Suggests: MASS, multicore
Published: 2010-11-30
Author: Surajit Ray and Yansong Cheng
Maintainer: Surajit Ray
License: GPL-2
CRAN checks: Modalclust results

Downloads:

Package source: Modalclust_0.2.tar.gz
MacOS X binary: Modalclust_0.2.tgz
Windows binary: Modalclust_0.2.zip
Reference manual: Modalclust.pdf
Vignettes: Model based clustering via mode identification
Old sources: Modalclust archive

Highlighting R codes on the fly

Check out http://www.inside-r.org/pretty-r



Monday, July 23, 2007

Run Length

A small function to get runlength from a vector



runlength=function(x){
run=1
k=1
for( i in 2: length(x)){
if(x[i]==x[i-1]) run[k]=run[k]+1
else{
k=k+1
run=c(run,1)
}
}

return(run)
}

Wednesday, April 18, 2007

Mandelbrot Set with R Animation

A few days ago I had the opportunity of having dinner with BenoƮt Mandelbrot
when he gave a seminar talk at the Bu Mathematics and Statistics Department. At the same time I was trying to find a way to produce animation in R. I came across this great post which was relevant for both purposes.

Using the code



### Reproduced from http://tolstoy.newcastle.edu.au/R/help/05/10/13198.html
### Written by Jarek Tuszynski, PhD.

library(fields) # for tim.colors
library(caTools) # for write.gif
m = 400 # grid size
C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
imag=rep(seq(-1.2,1.2, length.out=m), m ) )
C = matrix(C,m,m)


Z = 0
X = array(0, c(m,m,20))
for (k in 1:20) {
Z = Z^2+C
X[,,k] = exp(-abs(Z))
}
image(X[,,k], col=tim.colors(256)) # show final image in
write.gif(X, "Mandelbrot.gif", col=tim.colors(256), delay=100)


we get the following animation

Thursday, April 5, 2007

Color Map in a pie

pie(rep(1,40), col=rainbow(40))
pie(rep(1,40), col=heat.colors(40))

Wednesday, April 4, 2007

My plan

I am planning to maintain this blog to publish the every day tricks I learn working in R. Please feel free to post your comments and share interesting tricks