有没有办法为每个包含文本的元素添加空格?对于这个例子:
movie <- read_html("http://www.imdb.com/title/tt1490017/")
cast <- html_nodes(movie, "#titleCast span.itemprop")
cast %>% html_structure()
[[1]]
<span.itemprop [itemprop]>
{text}
[[2]]
<span.itemprop [itemprop]>
{text}
我想在使用之前html_text()
为每个文本元素添加一个尾随空格。我有另一个用例,我想html_text()
在文档层次结构中使用更高的位置。结果是多个文本组合在一个向量元素中。这使得无法推断相应部分的开始和结束。