key請由課綱選: 新課綱:https://docs.google.com/document/d/1o8UQIpy6GFqCgfUxc47fqyAPuEYrk3FLd7bB1EhYMVg

memberGmails: 為組員進入google classroom的gmail

knitr::opts_chunk$set(echo = TRUE, eval=F)
library(rmd2drake)
library(drake)

# If you use git and does not want to track cache folder, put down the following command:
# set_gitignore(".myCache")

makecondition

library(readr)
library(dplyr)
library(ggplot2)
library(svglite)

data

downloaddata = {
  taiwanStatistics <- readr::read_csv(
    "https://www.dropbox.com/s/n6fuvpo4cbz0oth/taiwanEconomicGrowth.csv?dl=1")
  taiwanStatistics
}
dataReady = {
  downloaddata %>%
  rename(
    "year"="X1"
  ) %>%
  mutate(
    across(
      everything(),
      as.numeric
    )
  )
}

graph

gg_taiwanEconomicGrowth = {
  dataReady %>%
    ggplot()+
    geom_line(
      aes(
        x=year, y=`economic growth rate(%)`
      )
    )
}
gg_taiwanEconomicGrowth = {
  dataReady %>%
    ggplot()+
    geom_line(
      aes(
        x=year, y=`economic growth rate(%)`
      ), color="red"
    )
}
gg_taiwanEconomicGrowth

export

save_gg_taiwanEconomicGrowth = {
  ggsave(
    "taiwanEconomicsGrowth.svg",
    gg_taiwanEconomicGrowth,
    width=8,
    height=5
  )

}


tpemartin/rmd2drake documentation built on Nov. 2, 2022, 10:14 a.m.