# Summary statistics set.seed(123) grades <- sample(70:100,50,replace = TRUE) mean(grades) median(grades) var(grades) sd(grades) summary(grades) # Bar chart 浏览器 <- c("Chrome", "Edge", "Firefox", "IE", "Opera", "Safari", "Others") 用户数 <- c(2502.4, 150.78, 395.83, 238.05, 86.49, 387.65, 134.8) IB = data.frame(浏览器, 用户数) barplot(height = IB$用户数, names.arg = IB$浏览器, main = "2018年浏览器用户数", xlab = '浏览器', ylab = '用户数', col = 'orange', border = 'red') # pie chart pie(IB$用户数, labels = IB$浏览器, main = "2018年浏览器使用情况") # bubble plot fat <- bodyfat plot(fat$Abdomen, fat$Weight, xlab = '腹围', ylab = '体重', main = '腹围-体重', pch = 16, col = "blue", cex = 1) plot(fat$Abdomen, fat$Weight, cex=fat$Chest/50, col="#69b3a2", pch=16) ## boxplot boxplot(weight~feed, data = chickwts)