r - UseMethod(“html_table”)中的错误:没有适用于“html_table”的方法应用于“xml_missing”类的对象
问题描述
我正在尝试从https://www.sports-reference.com/cbb/schools/bethune-cookman/2020-schedule.html中删除日程表,并且我看到了其他解决同一主题的问题,但是当我遵循该代码(如下)时,它仍然给我标题中的错误。有什么我想念的吗?
library(rvest)
url <- 'https://www.sports-reference.com/cbb/schools/bethune-cookman/2020-schedule.html'
schedule <- url %>%
read_html %>%
html_nodes(xpath = '//comment()') %>%
html_text() %>%
paste(collapse='') %>%
read_html() %>%
html_node('table#schedule') %>%
html_table()
解决方案
此表不在评论中。尝试 -
library(rvest)
url <- 'https://www.sports-reference.com/cbb/schools/bethune-cookman/2020-schedule.html'
schedule <- url %>% read_html %>% html_node('table#schedule') %>% html_table()
schedule
# A tibble: 30 x 15
# G Date Time Type `` Opponent Conf `` Tm Opp OT W L
# <int> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> <int> <chr> <int> <int>
# 1 1 Wed, … 7:00p REG "" Johnson… "" W 110 68 "" 1 0
# 2 2 Sat, … 8:00p REG "@" Texas T… "Big… L 44 79 "" 1 1
# 3 3 Mon, … 8:30p REG "@" Omaha "Sum… L 61 90 "" 1 2
# 4 4 Fri, … 7:00p REG "" Trinity… "" W 100 42 "" 2 2
# 5 5 Fri, … 1:00p REG "@" Incarna… "Sou… W 83 58 "" 3 2
# 6 6 Sat, … 1:00p REG "N" Eastern… "OVC" W 66 63 "" 4 2
# 7 7 Sun, … 1:00p REG "N" St. Fra… "" W 74 70 "" 5 2
# 8 8 Sun, … 6:00p REG "@" Georgia… "ACC" L 65 68 "" 5 3
# 9 9 Tue, … 7:00p REG "@" Stetson "A-S… L 67 72 "" 5 4
#10 10 Sat, … 6:00p REG "@" Jackson… "A-S… L 60 82 "" 5 5
# … with 20 more rows, and 2 more variables: Streak <chr>, Arena <chr>
推荐阅读
- javascript - 我想在 div 中显示 js 的结果
- python - python3.6 asyncio future done() 从嵌套的 ThreadPoolExecutor(线程中的线程)调用时永远不会返回 True
- if-statement - Google Sheets Ifs 语句:只计算一个逻辑表达式
- python - 验证 Django 模型中的 Django 模型字段
- java - 无法在 Ubuntu 中通过 selenium 启动 google chrome
- java - 地图到地图
从休息模板 - ansible - 如何每次使用时间戳在 ansible 中创建最新的备份文件。如何复制最新文件(相同文件到目的地)
- node.js - 无法将 MongoDB Atlas 连接到我的 goorm IDE
- kubernetes - Kubernetes:负载均衡器和入口
- .net - 在 Carter 框架中添加中间件会使某些 URL 不触发