Report question

Question: How to sample large database and implement K-means and K-nn in R?