I am using rvest
. And I would like to convert the result to a 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>
...
I used the following method:
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
However, I get an error:
Error in UseMethod("xmlSApply") :
no applicable method for 'xmlSApply' applied to an object of class "xml_nodeset"
Any suggestion what I am doing wrong?
I appreciate your replies!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…