In [1]:
iris <- read.csv('data/iris.csv')
names(iris) <- c("SepalLength", "SepalWidth", "PetalLength", "PetalWidth", "Name")
head(iris)
In [2]:
summary(iris)
In [3]:
setosa <- iris[iris$Name == "Iris-setosa",]
"Iris setosa"
summary(setosa)
versicolor <- iris[iris$Name == "Iris-versicolor",]
"Iris versicolor"
summary(versicolor)
virginica <- iris[iris$Name == "Iris-virginica",]
"Iris virginica"
summary(virginica)
In [4]:
hist(setosa$SepalLength,
xlab="Sepal length of Iris Setosa", main="Setosa's sepal length")
In [5]:
plot(setosa$SepalLength, setosa$SepalWidth, col='red', xlim=range(c(4,8)), ylim=range(c(2,4.5)),
xlab="Sepal Length", ylab="Sepal Width")
par(new=TRUE)
plot(virginica$SepalLength, virginica$SepalWidth, col='blue', xlim=range(c(4,8)), ylim=range(c(2,4.5)),
axes=FALSE, xlab='', ylab='')
par(new=TRUE)
plot(versicolor$SepalLength, versicolor$SepalWidth, col='green', xlim=range(c(4,8)), ylim=range(c(2,4.5)),
axes=FALSE, xlab='', ylab='')
In [6]:
library(ggvis)
options(jupyter.plot_mimetypes = 'image/png')
iris %>% ggvis(~SepalLength, ~SepalWidth, fill = ~Name) %>% layer_points()