data(iris)
str(iris)
## 'data.frame': 150 obs. of 5 variables:
## $ Sepal.Length: num 5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ...
## $ Sepal.Width : num 3.5 3 3.2 3.1 3.6 3.9 3.4 3.4 2.9 3.1 ...
## $ Petal.Length: num 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 1.4 1.5 ...
## $ Petal.Width : num 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 0.2 0.1 ...
## $ Species : Factor w/ 3 levels "setosa","versicolor",..: 1 1 1 1 1 1 1 1 1 1 ...
library(psych)
describe(iris)
## vars n mean sd median trimmed mad min max range skew
## Sepal.Length 1 150 5.84 0.83 5.80 5.81 1.04 4.3 7.9 3.6 0.31
## Sepal.Width 2 150 3.06 0.44 3.00 3.04 0.44 2.0 4.4 2.4 0.31
## Petal.Length 3 150 3.76 1.77 4.35 3.76 1.85 1.0 6.9 5.9 -0.27
## Petal.Width 4 150 1.20 0.76 1.30 1.18 1.04 0.1 2.5 2.4 -0.10
## Species* 5 150 2.00 0.82 2.00 2.00 1.48 1.0 3.0 2.0 0.00
## kurtosis se
## Sepal.Length -0.61 0.07
## Sepal.Width 0.14 0.04
## Petal.Length -1.42 0.14
## Petal.Width -1.36 0.06
## Species* -1.52 0.07
plot(x = iris$Sepal.Width, y = iris$Sepal.Length,
xlab = 'Sepal Width', ylab = 'Sepal Length',
col = iris$Species)
plot(x = iris$Petal.Width, y = iris$Petal.Length,
xlab = 'Petal Width', ylab = 'Petal Length',
col = iris$Species)
Questions:
There are 150 total cases in the data. However, there is 50 cases for each specific species of iris flower; which there were 3 of.
5 numeric variables in the data
Discrete: ‘Observation Number’: measuring occurrences and has counted and finite value.
Continuous: Sepal.Width, Sepal.Length, Petal.Width, Petal.Length: these are continuous because these variables are on a continuous scale and have decimal places.
data(BOD)
plot(y = BOD$demand, x = BOD$Time, type = 'l',
xlab = 'Time', ylab = 'Oxygen Demand')
describe(BOD)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## Time 1 6 3.67 2.16 3.5 3.67 2.22 1.0 7.0 6.0 0.26 -1.58 0.88
## demand 2 6 14.83 4.63 15.8 14.83 5.34 8.3 19.8 11.5 -0.29 -1.86 1.89
The dataset BOD shows Biochemical Oxygen Demand with ‘Time’ and ‘Oxygen Demand’ as the variables. This is a time series because it is tracking one entity (biochemical oxygen demand) over time.