key請由課綱選: 新課綱:https://docs.google.com/document/d/1o8UQIpy6GFqCgfUxc47fqyAPuEYrk3FLd7bB1EhYMVg
上傳時請交你的「Rmd檔」及「ggsave的SVG檔」,若有後製也請交上後製的SVG。由一個組員上傳到google classroom的作業繳交處。(通常是這次作業訊息公告的位置)
作圖資料:
總結:
上傳到Google classroom作業繳交處:Rmd, SVG
上傳到分享Google Drive Folder: 資料檔 (若公開資料且程式可下載則無需上傳)
params裡的訊息若無後製SVG可不寫imgPostName,其他都要填。
圖片一定要有Title, subtitle, 及資料來源。
knitr::opts_chunk$set(echo = TRUE, eval=F) library(drake) library(econDV) library(dplyr)
library(dplyr) library(tidyr) library(stringr) library(googledrive) library(readr) library(ggplot2) library(econDV) econDV::setup_chinese(need2Knit = F) rprojroot::is_rstudio_project -> .pj .pj$make_fix_file() -> .root imageFolder <- file.path(.root(),"img") dataFolder <- file.path(.root(),"data") if(!dir.exists(imageFolder)) dir.create(imageFolder) if(!dir.exists(dataFolder)) dir.create(dataFolder)
範例情境:
資料檔分享連結:https://drive.google.com/file/d/18L7z13xz_Rn_bYcQBhZR9wLxGZFgeO9e/view?usp=sharing
要下載回project folder, 並名命為'graph4week1.csv'。(請確認你makecondition有.root定義)
用readr::read_csv讀入資料。
datadownload = { # 下載google drive檔案 share link 到本機project folder, 本以graph4week.csv名稱儲存 googledrive::drive_download( file_in("https://drive.google.com/file/d/18L7z13xz_Rn_bYcQBhZR9wLxGZFgeO9e/view?usp=sharing"), path=file.path(dataFolder,"graph4week1.csv"), overwrite = T ) # 自本機project folder裡引入graph4week.csv為graph4week1 data frame物件 graph4week1 <- read_csv( file.path(dataFolder,"graph4week1.csv") ) }
myggplot = {
}
save_ggplot = { ggsave( plot=myggplot, filename=file.path(imageFolder, "myPlot.svg"), width = 8, height = 5 ) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.