Most code examples use the same data set, so you can try them out by simply copy-pasting the code into R:
R contains a huge number of data sets (a general library plus additional data found in packages). To access for instance the famous iris dataset, just type data(iris) and you can use it. data() shows all general datasets, plus those available in the currently loaded packages. data(package = .packages(all.available = TRUE)) lists all dataset in all currently installed packages.