Skip to content

Instantly share code, notes, and snippets.

@hrbrmstr

hrbrmstr/_README.md

Last active Oct 17, 2018
Embed
What would you like to do?
really pathetic child text tag extraction
library(rvest)
read_html(paste0(readLines(textConnection("<html>
<body>
<p> Simple paragraph </p>
<p> Another properly formatted simple paragraph </p>
<div>
<p> Another properly formatted simple paragraph in a div element </p>
</div>
</body>
</html>")), collapse="\n")) -> doc
map_chr(html_children(doc), html_text)
## [1] "\n Simple paragraph \n Another properly formatted simple paragraph \n\n Another properly formatted simple paragraph in a div element \n\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment