# Computing with Data

elgeish
106.4K views

## The Iris Dataset

The core R package datasets contains many interesting and demonstrative datasets, such as the iris dataset, whose first four dimensions are numeric measurements describing flower geometry and whose last dimension is a string describing the flower species. The below example explores the iris dataset:

library(datasets)
names(iris) # lists the dimension (column) names
head(iris, 4) # show first four rows
iris[1,] # first row
iris$Sepal.Length[1:10] # sepal length of first ten samples # allow replacing iris$Sepal.Length with the shorter Sepal.Length
attach(iris, warn.conflicts = FALSE)
mean(Sepal.Length) # average of Sepal.Length across all rows
colMeans(iris[, 1:4]) # means of all four numeric columns
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX