Q&A Read Files

setlocale() getlocale()

Read files on github.com

要直接讀取github.com最重要的訣竅是要找對資料鏈結。以ptt_hang_posts.csv 這個頁面而言,資料鏈結並不是https://github.com/P4CSS/R4CSSData/blob/main/ptt_hang_posts.csv 而是「https://github.com/P4CSS/R4CSSData/raw/main/ptt_hang_posts.csv

Related stackoverflow https://stackoverflow.com/questions/40138822/import-rds-file-from-github-into-r-windows.

Read rds by url

data_url <- "https://github.com/P4CSS/R4CSS/raw/master/data/newswawawa_yt_comments.rds"
raw <- read_rds(url(data_url))

Download then read

githubURL <- ("https://raw.githubusercontent.com/derek-corcoran-barrios/LastBat/master/best2.My.Lu2.rds")
download.file(githubURL,"best2.My.Lu2.rds", method="curl")
BestMyyu <- readRDS("best2.My.Lu2.rds")

Last updated

Was this helpful?