{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)
score <- data.frame( Statistic = c(68, 85, 74, 88, 63, 78, 90, 80,
58, 63), Math = c(85, 91, 74, 100, 82, 84, 78, 100, 51, 70) ) plot( Math
~ Statistic, data = score, xlab = “Statistic Score”, ylab = “Math
Score”, main = “Scatter Plot of Statistic vs Math”, pch = 16, col =
“#D3A4FF” ) hist( score$Math, main = “Histogram of Math Scores”, xlab =
“Math Score”, col = “#FFC1E0”, border = “black” ) categories <-
c(“公益活動”, “科學創新”, “體育競技”, “知識閱讀”, “娛樂休閒”) counts
<- c(8, 5, 7, 11, 20) barplot(counts, names.arg = categories, main =
“長條圖”, col = “#84C1FF”, ylab = “次數”)
data <- data.frame(社團類型 = c(“知識閱讀”, “娛樂休閒”, “體育競技”, “公益活動”, “科學創新”), 次數 = c(36, 82, 185, 25, 28))
my_colors <- c(“#9393FF”, “#AAAAFF”, “#B9B9FF”, “#CECEFF”, “#DDDDFF”)
pie(data\(次數,labels = data\)社團類型,main = “社團類型次數分配圓餅圖”,col = my_colors)
plot(counts, type=“h”, lwd=11, col=“#FFFF6F”, main=“棒棒糖圖”, xlab=“類別”, ylab=“頻數”) points(counts, pch=20, col=“#FFFF6F”) axis(1, at=1:length(categories), labels=categories)
scores <- c(84, 63, 61, 49, 89, 51, 59, 53, 79, 91) results <- list( “Mean” = mean(scores), “Median” = median(scores), “SD” = sd(scores), “Variance” = var(scores), “Q1” = quantile(scores, 0.25) ) print(results)
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:
{r cars} summary(cars)
You can also embed plots, for example:
{r pressure, echo=FALSE} plot(pressure)
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.