weight <- c(50,55,63,55,67,43,52)
high <- c(150,160,170,175,150,153,165)
mean(weight)
## [1] 55
# Load ggplot2
library(ggplot2)
# Load ggplot2
library(ggplot2)
# Create data
data <- data.frame(
name=c("王曉明","B","C","D","E","F") ,
value=c(50,55,63,55,67,43)
)
# Barplot
ggplot(data, aes(x=name, y=value)) +
geom_bar(stat = "identity", width=0.2, fill="skyblue")

plot(weight,
pch = 17,
col= "skyblue",
main ="班上的體重與身高",
xlab ="體重",
ylab ="身高")

hist(weight,
col= "lightyellow",
main ="班上的體重與身高",
xlab ="體重",
ylab ="次數")

weight<- c(50,23,35,48)
labels <- c("英文系","法文系","德文","翻譯")
pie(weight,labels,main ="學生的比例", col=heat.colors(length(weight)))
