If you pick up more advanced statistics textbooks, you'll often find that they have code examples that are written in R.