Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 如何在下一个相同的标签之前保留标签特定标题中的内容_R_Xml2 - Fatal编程技术网

R 如何在下一个相同的标签之前保留标签特定标题中的内容

R 如何在下一个相同的标签之前保留标签特定标题中的内容,r,xml2,R,Xml2,输入 data.frame(id=c(1,2),text=c(“在这里也保留删除这个标签和这个”,“又一个错误警报示例,另一个不是这个”)) 如何才能保留标签“保留”后面的内容?我的意思是检查标签中哪个h1有保留或假警报文本,并将此标签后面的内容保留到下一个标签 示例输出 data.frame(id = c(1,2), text = c("<h1>keep </h1> also here <li> remove this tag </li&g

输入

data.frame(id=c(1,2),text=c(“在这里也保留
  • 删除这个标签和这个”,“又一个错误警报示例,另一个不是这个”))
  • 如何才能保留标签“
    保留
    ”后面的内容?我的意思是检查标签中哪个h1有保留或假警报文本,并将此标签后面的内容保留到下一个
    标签

    示例输出

    data.frame(id = c(1,2), text = c("<h1>keep </h1> also here <li> remove this tag </li> and <h1> this </h1>", "one more example <h1> false alarm </h1> another one <h1>not this</h1>"))
    
    data.frame(id=c(1,2),text=c(“在这里也保留
  • 删除此标记,
  • 和”,“一个又一个假警报示例”))
    data.frame(id = c(1,2), text = c("<h1>keep </h1> also here <li> remove this tag </li> and", "one more example <h1> false alarm </h1> another one"))