R MarkdownC

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

we <- c(85,91,74,100,82,84,78,100,51,70)
we2 <- c(68,85,74,88,63,78,90,80,58,63)
mean(we)
## [1] 81.5
median(we) 
## [1] 83
min(we)
## [1] 51
max(we)
## [1] 100
as.numeric(names(table(we)))[which.max(table(we))] 
## [1] 100
sd(we)
## [1] 14.62304
var(we)
## [1] 213.8333
plot(we,we2,
     pch = 17,
     col= "DARKRED",
     main ="統計數學成績",
     xlab ="MATH",
     ylab ="STATISTIC")

we <- c(85,91,74,100,82,84,78,100,51,70)
hist(we,
     col= "lightyellow",
     main ="數學成績",
     xlab ="MATH",
     ylab ="人數")

library(ggplot2)

data <- data.frame(
  社團類型=c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動") ,  
  次數=c(185,82,36,28,25)
)

ggplot(data, aes(x=社團類型, y=次數)) + 
  geom_bar(stat = "identity", width=0.8) 

data <-c(185,82,36,28,25)
labels <- c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動")
pie(data,labels, col=heat.colors(length(data)))

data<- data.frame(
  社團類型 =c("娛樂休閒","知識閱讀","體育競技","科學創新","公益活動"),
  次數=c(185,82,36,28,25)
)

ggplot(data, aes(x=社團類型, y=次數)) +
  geom_segment( aes(x=社團類型, xend=社團類型, y=0, yend=次數)) +
  geom_point( size=5, color="red", fill=alpha("orange", 0.3), alpha=0.7, shape=21, stroke=2) 

library(readxl)
 Data <-read.csv("C:/Users/蘇培堯/Downloads/103.csv")
 stem(Data$Japanese)
## 
##   The decimal point is 1 digit(s) to the right of the |
## 
##   4 | 9
##   5 | 139
##   6 | 13
##   7 | 9
##   8 | 49
##   9 | 1