如何使用 R 从此网页中提取这个特定的 table?
How can I extract this specific table from this web page using R?
我正在尝试从特定网页中提取 table,但我的代码没有得到任何结果。
我的代码如下:
library(rvest)
library(dplyr)
url1<-"https://finance.yahoo.com/quote/SKLZ/cash-flow?p=SKLZ"
url_page<- read_html(url1)
listings <- html_nodes(url_page, css = '.Pos')
我有兴趣提取的 table 属于(在 Chrome 中进行“检查”之后)。
这是 table 的屏幕截图:
如有任何帮助,我们将不胜感激。
我已经从他们的答案中复制了相关代码。
library(rvest)
library(stringr)
library(magrittr)
page <- read_html("https://finance.yahoo.com/quote/SKLZ/cash-flow?p=SKLZ")
nodes <- page %>%html_nodes(".fi-row")
df = NULL
for(i in nodes){
r <- list(i %>%html_nodes("[title],[data-test='fin-col']")%>%html_text())
df <- rbind(df,as.data.frame(matrix(r[[1]], ncol = length(r[[1]]), byrow = TRUE), stringsAsFactors = FALSE))
}
df
我正在尝试从特定网页中提取 table,但我的代码没有得到任何结果。
我的代码如下:
library(rvest)
library(dplyr)
url1<-"https://finance.yahoo.com/quote/SKLZ/cash-flow?p=SKLZ"
url_page<- read_html(url1)
listings <- html_nodes(url_page, css = '.Pos')
我有兴趣提取的 table 属于(在 Chrome 中进行“检查”之后)。
这是 table 的屏幕截图:
如有任何帮助,我们将不胜感激。
library(rvest)
library(stringr)
library(magrittr)
page <- read_html("https://finance.yahoo.com/quote/SKLZ/cash-flow?p=SKLZ")
nodes <- page %>%html_nodes(".fi-row")
df = NULL
for(i in nodes){
r <- list(i %>%html_nodes("[title],[data-test='fin-col']")%>%html_text())
df <- rbind(df,as.data.frame(matrix(r[[1]], ncol = length(r[[1]]), byrow = TRUE), stringsAsFactors = FALSE))
}
df