The following code retrieves the UCI Pittsburg Bridges Set and creates a data.frame consisting of columns for years erected, purpose, material, and type.
#retrieve and load data into a data.frame
theUrl <- "http://archive.ics.uci.edu/ml/machine-learning-databases/bridges/bridges.data.version1"
dat <- read.table(file = theUrl, header = FALSE, sep = ",", na.string = "?")
#Pick and name Columns
bridges <- subset(dat, select = c(4, 5, 10, 13))
colnames(bridges) <- c("erected", "purpose", "material", "b_type")
#check the data.frame
class(bridges)
## [1] "data.frame"
summary(bridges)
## erected purpose material b_type
## Min. :1818 AQUEDUCT: 4 IRON :11 SIMPLE-T:44
## 1st Qu.:1884 HIGHWAY :71 STEEL:79 WOOD :16
## Median :1903 RR :32 WOOD :16 ARCH :13
## Mean :1905 WALK : 1 NA's : 2 CANTILEV:11
## 3rd Qu.:1928 SUSPEN :11
## Max. :1986 (Other) :11
## NA's : 2