s <- c(68,85,74,88,63,78,90,80,58,63)
m <- c(85,91,74,100,82,84,78,100,51,70)
##畫圖
plot(s, m,
pch = 19,
col = "blue")

hist(s,freq = FALSE,
main = "統計直方圖",
xlab = "統計成績",ylab="次數")

# Load ggplot2
library(ggplot2)
# Create data
data <- data.frame(
name=c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動") ,
value=c(185,82,36,28,25)
)
# Barplot
ggplot(data, aes(x=name, y=value)) +
geom_bar(stat = "identity", width=0.2)

# Create Data
Prop <-c(185,82,36,28,25)
# Make the default Pie Plot
pie(Prop , labels = c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動"))

# Libraries
library(ggplot2)
# Create data
# Plot
ggplot(data, aes(x=name, y=value)) +
geom_point() +
geom_segment( aes(x=name, xend=name, y=0
, yend=value))

data2 <- read.csv("D:/table.csv")
#平均數 總合除個數
mean(data2$Japanese)
## [1] 67.9
#中位數:將資料由小到大,位置居中者,就是中位數
median(data2$Japanese)
## [1] 62
#標準差
sd(data2$Japanese)
## [1] 16.25115
#變異數
var(data2$Japanese)
## [1] 264.1
sd(data2$Japanese)
## [1] 16.25115
summary(data2)
## Name Statistic Math Japanese
## Length:10 Min. :58.00 Min. : 51.0 Min. :49.00
## Class :character 1st Qu.:64.25 1st Qu.: 75.0 1st Qu.:54.50
## Mode :character Median :76.00 Median : 83.0 Median :62.00
## Mean :74.70 Mean : 81.5 Mean :67.90
## 3rd Qu.:83.75 3rd Qu.: 89.5 3rd Qu.:82.75
## Max. :90.00 Max. :100.0 Max. :91.00
## Management Accounting
## Min. :60.00 Min. :60.0
## 1st Qu.:72.25 1st Qu.:66.0
## Median :77.00 Median :69.5
## Mean :77.50 Mean :73.0
## 3rd Qu.:83.75 3rd Qu.:81.5
## Max. :91.00 Max. :86.0