kNN randomization test in R? I am trying to determine significant differences between groups of data using a k-nearest neighbor randomization test in R. This test basically looks for similarity amongst homogenous groups and separates them out using random clustering. In the literature, this test is called a "K-nearest neighbor (kNN) randomization test," however, I'm not certain if it called by other names elsewhere.
For my specific data, I have isotopic ratios given for various prey items. I have already grouped together ecologically similar prey item types, and now want to see if those groups differ from one another in their isotopic signature. This is where the kNN test would come in. 
Thanks for all of your answers - I'm new to this site, so I'll address your inquiries as applicable in the comments section.
 A: kmeans() (you can find it by typing ?? followed by the name of what you want as in ??kmean). In general, a good trick is to first look it up on a R specific search engine 
A: You appear to have confused "cluster analysis" with "classification". The former is where you don't know the groupings and wish to determine them from the training data to hand. Classification is where you know the groups and want to predict them.
There are a few packages in R that do this. For example, look at the results of this R Site Search for suitable packages.
Alternatively, perhaps you are looking for a multivariate analysis of variance? In which case lm() and aov() would be worth looking at for a start. This presumes you want to "model" your data as a function of the group variable?
A: I am not sure to understand your question since you talk about k-means, which is basically an unsupervised method (i.e. where classes are not known a priori), while at the same time you are saying that you already identified groups of individuals. So I would suggest to look at classification methods, or other supervised methods where class membership is known and the objective is to find a weighted combination of your variables that minimize your classification error rate (this is just an example). For instance, LDA does a good job (see the CRAN task view on Multivariate Statistics), but look also at the machine learning community (widely represented on the stats.stackexchange) for other methods.
Now since you also talked of k-nearest neighbor, I wonder if you are not introducing a confusion between k-means and kNN. In this case, the corresponding R function is knn() in the class package (it includes cross-validation), or see the kknn package.
A: I wouldnt cluster or classify the data at all. Since youve got ratio scaled data (isotopes) my method of choice would be PCA (Principal Component Analysis). By colouring your points in the PCA diagram according to your "eco-type" you could see their dispersal within the isotope ratio variation. Further, you will see the influence of each parameter (isotope ratios) in the biplot - the result will contain much more information than a classification.
