開始使用免費開始

讀取 HTML

看看下面這段來自某網站的內容:


Web Scraping is cool

It involves writing code – be it R or Python.

DataCamp has courses on it.


對應的 HTML 已放在變數 html_excerpt_raw 中。

在這個練習中,你會使用 rvest 把它讀進 R,方便你後續操作。

因為你在整門課都會使用 rvest 套件,所以我們已經幫你用 library(rvest) 載入好了。

本練習屬於課程

R 的網頁爬蟲

檢視課程

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

html_excerpt_raw <- '
 
   
    

Web scraping is cool

It involves writing code – be it R or Python.

DataCamp has courses on it.

' # Turn the raw excerpt into an HTML document R understands html_excerpt <- ___ html_excerpt
編輯並執行程式碼