Senhores, bom dia!

Melhorei o código anterior e agora já está capturando os dados em um objeto
do tipo lista.

Falta passar de lista pra data.frame... Ainda não fiz porque os elementos
da lista estão com tamanhos diferentes e tenho que pensar numa estratégia.
Se tiverem interesse e puderem finalizar, fiquem à vontade.

### <code r>
setwd("C:/LAB/RBAS/dataMining")
sapply(c("RCurl", "XML", "RJSONIO"), require, character.only=T)

html.ori <- getURL("http://www.whoscored.com/Teams/1232";)
html.lin <- readLines(tcon <- textConnection(html.ori)); close(tcon)
# pagetree <- htmlTreeParse(html.lin, error=function(...){},
useInternalNodes = TRUE)

sel      <- grep("DataStore.prime\\(\\'stage-player-stat\\'", html.lin)
data     <- html.lin[sel]
djson    <- gsub("^.*DataStore.*\\[(.*)\\]);", "\\[\\1\\]", data)

res      <- fromJSON(djson)

res
### <code>



Éder Comunello <c <[email protected]>[email protected]>
Dourados, MS - [22 16.5'S, 54 49'W]
_______________________________________________
R-br mailing list
[email protected]
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código 
mínimo reproduzível.

Responder a