Revolutions blog recently posted a link to R code by Joshua Reich with self-contained examples of using machine learning techniques in R, including various clustering methods (k-means, nearest neighbor, and kernel), recursive partitioning (CART), principle components analysis, linear discriminant analysis, and support vector machines. This post also links to some slides that go over the basics of machine learning. Looks like a good place to start learning about ML before handrolling your own code.
Be sure to check out one of Will's previous post on hierarchical clustering in R.
Revolutions: Machine learning in R, in a nutshell