Here are a few data sets to play around with.

mtcars

print(head(mtcars))
                   mpg cyl disp  hp drat    wt  qsec vs am gear carb
Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1

This is a built-in data set. Use it for sorting, filtering etc.

Quickly generating a data set

You can use matrix to generate a quick dataset. The first argument must contain your data. You can use a distribution function or sample for it.

print(matrix(runif(6*3), nrow=6, ncol=3))
          [,1]       [,2]       [,3]
[1,] 0.94210093 0.23582446 0.19571104
[2,] 0.45026399 0.77989358 0.69763985
[3,] 0.03567169 0.40572983 0.83394039
[4,] 0.31246289 0.08076585 0.74957412
[5,] 0.61316957 0.94886782 0.90769685
[6,] 0.94545758 0.48658449 0.03396954

Real US data: data.gov

The US government published data sets on data.gov. This includes US census data. Most files are in CSV format and you can use read.table to read them.

International data

The UN publishes data at data.un.org. This data is also available in CSV format.