…或更短的尝试:
library(XML)library(RCurl)library(rlist)theurl <- getURL("https://en.wikipedia.org/wiki/Brazil_national_football_team",.opts = list(ssl.verifypeer = FALSE) )tables <- readHTMLTable(theurl)tables <- list.clean(tables, fun = is.null, recursive = FALSE)n.rows <- unlist(lapply(tables, function(t) dim(t)[1]))选择的表是页面上最长的表
tables[[which.max(n.rows)]]



