This is probably the coolest-looking thing I’ve figured out how to do with raster images in R. Similar to (although not quite as impressive as) these images by Jeff Clark, I alter the simple k-means approach described in the previous post to cluster primarily in Cartesian space, rather than in color space. This produces, essentially, Voronoi regions shaded with a region-average color, and the effect is really neat.

Note that increasing nRegions can produce drastically different results, but that kmeans() is quite slow as nRegions increases. Below, you’ll find a few examples, as well as the code. If you use this to make anything impressive, share it with us at @isDotR.

*Related*

To

**leave a comment** for the author, please follow the link and comment on their blog:

** is.R()**.

R-bloggers.com offers

**daily e-mail updates** about

R news and

tutorials on topics such as:

Data science,

Big Data, R jobs, visualization (

ggplot2,

Boxplots,

maps,

animation), programming (

RStudio,

Sweave,

LaTeX,

SQL,

Eclipse,

git,

hadoop,

Web Scraping) statistics (

regression,

PCA,

time series,

trading) and more...

If you got this far, why not

__subscribe for updates__ from the site? Choose your flavor:

e-mail,

twitter,

RSS, or

facebook...