data(iris)
library(ggplot2)
head(iris,n=5)
## 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
tbinh
mean(iris$Sepal.Length)
## [1] 5.843333
mean(iris$Sepal.Width)
## [1] 3.057333
phuong sai
var(iris$Sepal.Length)
## [1] 0.6856935
var(iris$Sepal.Width)
## [1] 0.1899794
do lech chuan
sd(iris$Sepal.Length)
## [1] 0.8280661
sd(iris$Sepal.Width)
## [1] 0.4358663
ggplot
ggplot(data=iris, mapping = aes(x=Sepal.Length, y=Sepal.Width, color=Species))+
geom_point()+
labs(title = "bieu do",
x="Length",
y="Width")
