Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html_table(..., fill=TRUE) bug in filling rowspans down #215

Closed
oguzhanogreden opened this issue May 3, 2018 · 1 comment · Fixed by #293
Closed

html_table(..., fill=TRUE) bug in filling rowspans down #215

oguzhanogreden opened this issue May 3, 2018 · 1 comment · Fixed by #293
Labels
bug an unexpected problem or unintended behavior table 🏓

Comments

@oguzhanogreden
Copy link

The bug can be reproduced using an example table from Wikipedia (couldn't find a English example page, this page lists the parliament members of Turkey).

bug <- read_html('https://tr.wikipedia.org/wiki/TBMM_8._d%C3%B6nem_milletvekilleri_listesi') %>%
    html_nodes('.wikitable') %>%
    html_table(fill = TRUE)
bug[[1]][136:142,]

This happens because nrows is not updated when rowspans are filled. For instance in this case, when i == 2 and j == 138, nrows[[j]][i] will be 7, although it should be 1.

This has an easy fix, I'll be creating a PR soon.

@hadley hadley added bug an unexpected problem or unintended behavior table 🏓 labels Mar 17, 2019
@apreshill
Copy link

I believe I have just hit on the same issue- here is a reprex from a page written in English:

library(rvest)
#> Loading required package: xml2

url <- "https://en.wikipedia.org/wiki/The_Great_British_Bake_Off"
page <- read_html(url)

series <- page %>%
  html_nodes("table.wikitable") %>%
  .[[1]] %>%
  html_table(fill = TRUE)
#> Error in out[j + k, ]: subscript out of bounds

Created on 2019-09-29 by the reprex package (v0.3.0)

Also looks to be related to this issue on Stack Overflow.

hadley added a commit that referenced this issue Dec 19, 2020
And make it return a tibble.

Fixes #63. Fixes #204. Fixes #215. Fixes #199.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior table 🏓
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants