1 min read

Working with Web Data in R 学习笔记

Charlotte Wickham | DataCamp 他老姐在教。

  • Introduction: Working With Web Data in R | R

  • Downloading files and using specialised packages to get data from web

  • httr package to query APIs using GET() and POST()

  • JSON and XML 1: data formats commonly returned

  • CSS 2 to navigate and extract data from webpages

download.file()可以防止每次链接网络,好累。

csv_url <- "http://s3.amazonaws.com/assets.datacamp.com/production/course_1561/datasets/chickwts.csv"
# Download the file with download.file()
download.file(url = csv_url, destfile = "feed_data.csv")
# Read it in with read.csv()
csv_data <- read.csv("feed_data.csv")

  1. XML /xmail/, XPath XML language nested /nistied/ strutured data.

  2. css Cascading Style Sheets, html pages.