Sto usando rvest
. E vorrei convertire il risultato a un frame di dati:Converti xml_nodeset in data.frame
> links <- pgsession %>% jump_to(urls[2]) %>% read_html() %>% html_nodes("a")
> links
{xml_nodeset (114)}
[1] <a href="/Mitglieder/Detail/1213412">Date</a>
[2] <a href="/Account/ChangePassword">Kennwort ändern</a>
[3] <a href="/Account/BenutzernamenAendern/124312234">Benutzernamen ändern</a>
[4] <a href="/Account/LogOff">Abmelden</a>
...
ho usato il seguente metodo:
library(plyr)
ldply(xmlToList(links), data.frame)
Error in UseMethod("xmlSApply") :
no applicable method for 'xmlSApply' applied to an object of class "xml_nodeset"
df1 <- data.frame(character(13000))
df1 <- rbind(df1, data.frame(links))# append to data.frame
Tuttavia, ottengo un errore:
Error in UseMethod("xmlSApply") :
no applicable method for 'xmlSApply' applied to an object of class "xml_nodeset"
Qualsiasi suggerimento che cosa Sto sbagliando?
Apprezzo le tue risposte!
Che dire di 'data.frame (hrefs = as (link," carattere "))'? – lukeA