sagarnikam123
2012-Apr-21 14:05 UTC
[R] how to write html output (webscraped using RCurl package) into file?
i want "http://scop.berkeley.edu/astral/pdbstyle/?id=d1fjgc2&output=html",showing information in webpage to be written in .txt file as it is(i don't want any html tag) i am using "RCurl" package>marathi<-htmlTreeParse("http://scop.berkeley.edu/astral/pdbstyle/?id=d1fjgc2&output=html") >marathi >kasam<-marathi$children$html[["body"]][["pre"]][["text"]] >kasam > write(kasam,"papita.txt")Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'list') cannot be handled by 'cat i want to write kasam, as shown on console into .txt file -- View this message in context: http://r.789695.n4.nabble.com/how-to-write-html-output-webscraped-using-RCurl-package-into-file-tp4576476p4576476.html Sent from the R help mailing list archive at Nabble.com.
Milan Bouchet-Valat
2012-Apr-21 20:08 UTC
[R] how to write html output (webscraped using RCurl package) into file?
Le samedi 21 avril 2012 ? 07:05 -0700, sagarnikam123 a ?crit :> i want > "http://scop.berkeley.edu/astral/pdbstyle/?id=d1fjgc2&output=html",showing > information in webpage to be written in .txt file as it is(i don't want any > html tag) > i am using "RCurl" package > > >marathi<-htmlTreeParse("http://scop.berkeley.edu/astral/pdbstyle/?id=d1fjgc2&output=html") > >marathi > >kasam<-marathi$children$html[["body"]][["pre"]][["text"]] > >kasam > > write(kasam,"papita.txt") > Error in cat(list(...), file, sep, fill, labels, append) : > argument 1 (type 'list') cannot be handled by 'cat > > i want to write kasam, as shown on console into .txt filekasam is a list, not a character string:> str(kasam)Named list() - attr(*, "class")= chr [1:5] "XMLTextNode" "XMLNode" "RXMLAbstractNode" "XMLAbstractNode" ... You need to convert it to a character vector first: write(xmlValue(kasam), "papita.txt") Regards
Seemingly Similar Threads
- Sweave files generating miktex errors
- Webscraping - How to Scrape Out Text Into R As If Copied & Pasted From Webpage?
- issue with Rd2pdf and \Sexpr in Rd files
- Passing the parameters for web form using getHTMLFormDescription
- postForm() in RCurl and library RHTMLForms