data(iris)
Using the dim function, We find that there are 150 cases in iris data.
dim(iris)
## [1] 150 5
Using head function to display the top 10 rows of iris data, there are 4 numerical variables: Sepal.Length, Sepal.Width, Petal.Length, and Petal.Width.
The definitions for continuous and discrete same vague to me. However, using the reference from a Georgia State School website (ref: http://www.henry.k12.ga.us/ugh/apstat/chapternotes/7supplement.html), all of the numerical variables of iris are continuous because they each need to be measured to arrive at lengths and widths.
head(iris,10)
## Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1 5.1 3.5 1.4 0.2 setosa
## 2 4.9 3.0 1.4 0.2 setosa
## 3 4.7 3.2 1.3 0.2 setosa
## 4 4.6 3.1 1.5 0.2 setosa
## 5 5.0 3.6 1.4 0.2 setosa
## 6 5.4 3.9 1.7 0.4 setosa
## 7 4.6 3.4 1.4 0.3 setosa
## 8 5.0 3.4 1.5 0.2 setosa
## 9 4.4 2.9 1.4 0.2 setosa
## 10 4.9 3.1 1.5 0.1 setosa
Only 1 categorial variable exists: Species.
Using some R methods to obtain the unique values of species, we find that the levels are: setosa, versicolor, and virginica.
speciestable <- iris[,c(5)]
specieslevels <- unique(speciestable)
specieslevels
## [1] setosa versicolor virginica
## Levels: setosa versicolor virginica