web scraping (web에서 데이터 긁어오기)

Published by onesixx on

https://www.freecodecamp.org/news/an-introduction-to-web-scraping-using-r-40284110c848/

rvest 팩키지

GDP time-serise 데이터

library("rvest") # Easily Harvest (Scrape) Web Pages
URL = "https://www.multpl.com/us-real-gdp-growth-rate/table/by-quarter" # GDP data
gdptbl <- URL %>% read_html() %>% html_table()   # Read the data from the web page
gdptbl <- gdptbl[[1]] %>% data.table()
names(gdptbl) <- c("index", "value")

100m 달리기 기록 데이터

library("rvest")

URL="https://www.iaaf.org/records/toplists/sprints/100-metres/outdoor/men/senior/2019"
runner <- URL %>% read_html() %>% html_table()
runner <- runner[[3]] %>% data.table()
runner %>% str()
Categories: quantReshaping

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x