📘
R4CSS
search
⌘Ctrlk
📘
R4CSS
  • Welcome
  • Homearrow-up-right
  • 前言
    • 學習資源
    • 教學影片與路徑
    • Slides
    • Interested Data
    • Data-driven news reports
  • I R語言基礎
    • 開始使用R
    • What is data?
    • Vector
    • dataframe
    • RDS and RDA
  • II 讀取檔案
    • 讀取Excel:產假支薪
    • 讀取CSV:北市竊盜案常發地點
    • Q&A Read Files
  • III 操作資料dplyr
    • 用dplyr彙整摘要資料
    • 用dplyr操作資料
    • 繪製圖表ggplot2
  • IV 文字探勘
    • 字串
    • Regular expression
    • Collocation
  • V 網路資料爬蟲實作
    • 爬蟲概念簡介
    • 獲取網頁JSON檔
    • 爬剖HTML檔
    • 爬蟲進階Post與cookies
    • XML剖析
    • Using API
  • VI 文字探勘進階
    • Untitled
  • VII 機器學習基礎
    • 機器學習簡介
  • X1-Data Engineering
    • R and SQL
  • Assignments
    • AS#04 yt-comment visualization
  • Appendix
    • 時間處理
    • TroubleShooting
    • 常用函式
    • Using git version control
    • Editors
gitbookPowered by GitBook
block-quoteOn this pagechevron-down
  1. II 讀取檔案

Q&A Read Files

hashtag
setlocale() getlocale()

https://psmethods.postach.io/post/ru-he-geng-gai-rde-yu-she-yu-xipsmethods.postach.iochevron-right

hashtag
Read files on github.com

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

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

hashtag
Read rds by url

hashtag
Download then read

Previous讀取CSV:北市竊盜案常發地點chevron-leftNext用dplyr彙整摘要資料chevron-right

Last updated 5 years ago

  • setlocale() getlocale()
  • Read files on github.com
  • Read rds by url
  • Download then read
data_url <- "https://github.com/P4CSS/R4CSS/raw/master/data/newswawawa_yt_comments.rds"
raw <- read_rds(url(data_url))
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")