0
rvest를 사용하여 위키 백과에서 HTML 표를 긁어 내고 있습니다. 링크가 포함 된 셀이있을 때마다 html_table()을 실행 한 후 실제 텍스트와 내 R 데이터 프레임에있는 링크의 이름을 얻습니다.rvest 위키 백과 링크가있는 셀을 긁어서 복제본을 만듭니다
다음은 예입니다.
dplyr::glimpse(males)
Observations: 91
Variables: 9
$ `#` <chr> "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "1...
$ Actor <chr> "Jannings, EmilEmil Jannings", "Baxter, WarnerWarner Baxter...
$ Film <chr> "The Way of All Flesh and The Last CommandThe Last Command,...
$ `Date of birth` <chr> "1884-07-23(1884-07-23)July 23, 1884", "1889-03-29(1889-03-...
$ `Date of award` <chr> "May 16, 1929 (1929-05-16)", "April 3, 1930 (1930-04-03)", ...
$ `Age upon\nreceiving award` <chr> "44-2977004163670000000000♠44 years, 297 days", "41-0057004...
$ `Date of death` <chr> "1950-01-02(1950-01-02)January 2, 1950", "1951-05-07(1951-0...
$ Lifespan <chr> "23,903 days (7004239030000000000♠65 years, 163 days)", "22...
$ Notes <chr> "Held record as oldest winner for 2 award ceremonies (from ...
내가 그냥 가지고있는 이름, 예를 들어, "Jannings, 에밀"대신 "Jannings, EmilEmil을 선호 : 배우의 이름이 반복되는 dataframe을 생산
males_raw <- read_html("https://en.wikipedia.org/wiki/List_of_Academy_Award_Best_Actor_winners_by_age")
males <- males_raw %>%
html_nodes(xpath='//*[@id="mw-content-text"]/div/table') %>%
html_table()
males <- males[[1]]
자닝 "
고마워!