2
どのようにすればこのXMLを解析して、希望の結果を得ることができますか?私が試したすべての設定は、単一のベクトルで5つのa href=
のリンクをまとめてグループ化していますが、2つの結果を<div class="entry-content">
で区別する必要があります。ありがとう!xmlをrvestで子どもの数を変えて解析する方法
# xml snippet from
# http://www.electionstudies.org/studypages/download/datacenter_all_NoData.html
my_xml <-
'<li class="clearfix">
<article class="entry-item">
<div class="entry-content">
<h4 class="entry-title"><img src="../../images/icons/timeseries.png"><a href="../anes_timeseries_cdf/anes_timeseries_cdf.htm">ANES Time Series Cumulative Data File</a> (1948-2012)</h4>
<p class="indented_text">Data documentation: <a href="../anes_timeseries_cdf/anes_timeseries_cdf.htm"> Study Page</a> <img src="../../images/icons/circle.png" /> <a href="../anes_timeseries_cdf/anes_timeseries_cdf_errata.htm">Errata</a></p>
</div><!--entry-content-->
</article><!--entry-item-->
</li>
<li class="clearfix">
<article class="entry-item">
<div class="entry-content">
<h4 class="entry-title"><img src="../../images/icons/pilot.png"><a href="../anes_pilot_2016/anes_pilot_2016.htm">ANES 2016 Pilot Study</a></h4>
<p class="indented_text">Data documentation: <a href="../anes_pilot_2016/anes_pilot_2016.htm">Study Page</a></p>
</div><!--entry-content-->
</article><!--entry-item-->
</li>'
# desired result
list(
c("../anes_timeseries_cdf/anes_timeseries_cdf.htm" , "../anes_timeseries_cdf/anes_timeseries_cdf.htm" , "../anes_timeseries_cdf/anes_timeseries_cdf_errata.htm") ,
c("../anes_pilot_2016/anes_pilot_2016.htm" , "../anes_pilot_2016/anes_pilot_2016.htm")
)
これを可能にしてくれてありがとうございます。 "devesools :: install_github(" ajdamico/lodown ");ライブラリ(lodown); lodown(" anes "、output_dir =" C:/ My Directory/ANES "、your_email =" [email protected] ")' –
*超軽量の袋。 – hrbrmstr