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 the error message:
Error in UseMethod("xmlSApply") : no applicable method for 'xmlSApply' applied to an object of class "xml_nodeset"
Any suggestion what am I doing wrong?
I appreciate your answers!
source share