我有一个文本文件(myFile.txt),我试图将其转换为 data.frame
这是一个摘录
<li>
<a title="Data table: Grand Falls-Windsor (Census Agglomeration), Newfoundland and Labrador" href="../../details/page.cfm?Lang=E&Geo1=CMA&Code1=010&Geo2=PR&Code2=01&Data=Count&SearchText=Grand%20Falls-Windsor&SearchType=Begins&SearchPR=01&B1=All&GeoLevel=PR&GeoCode=010&TABID=1">Grand Falls-Windsor (<acronym title="Census Agglomeration">CA</acronym>)</a> [<a href="../../details/page_Map_Carte_Detail.cfm?Lang=E&G=1&Geo1=CMA&Code1=010&Geo2=PR&Code2=01&Data=Count&SearchText=&SearchType=Begins&SearchPR=01&B1=All&Custom=&TABID=1&geocode=010" title="Map: Grand Falls-Windsor (Census Agglomeration), Newfoundland and Labrador">map</a>]
</li>
<li>
<a title="Data table: St. John's (Census Metropolitan Area), Newfoundland and Labrador" href="../../details/page.cfm?Lang=E&Geo1=CMA&Code1=001&Geo2=PR&Code2=01&Data=Count&SearchText=St.%20John's&SearchType=Begins&SearchPR=01&B1=All&GeoLevel=PR&GeoCode=001&TABID=1">St. John's (<acronym title="Census Metropolitan Area">CMA</acronym>)</a> [<a href="../../details/page_Map_Carte_Detail.cfm?Lang=E&G=1&Geo1=CMA&Code1=001&Geo2=PR&Code2=01&Data=Count&SearchText=&SearchType=Begins&SearchPR=01&B1=All&Custom=&TABID=1&geocode=001" title="Map: St. John's (Census Metropolitan Area), Newfoundland and Labrador">map</a>]
</li>
df <- read.table("myFile.txt",sep="\n")
这一直有效到大瀑布提取物结束,但\n
似乎没有生效。这是一行控制台读数,您可以看到\n
末尾有 s 没有生效。
\t\t\t\t\t\t<a title=Data table: St. John's (Census Metropolitan Area), Newfoundland and Labrador href=../../details/page.cfm?Lang=E&Geo1=CMA&Code1=001&Geo2=PR&Code2=01&Data=Count&SearchText=St.%20John's&SearchType=Begins&SearchPR=01&B1=All&GeoLevel=PR&GeoCode=001&TABID=1>St. Johns (<acronym title="Census Metropolitan Area">CMA</acronym>)</a> [<a href="../../details/page_Map_Carte_Detail.cfm?Lang=E&G=1&Geo1=CMA&Code1=001&Geo2=PR&Code2=01&Data=Count&SearchText=&SearchType=Begins&SearchPR=01&B1=All&Custom=&TABID=1&geocode=001" title="Map: St. Johns (Census Metropolitan Area), Newfoundland and Labrador>map</a>]\n\t\t\t\t\t\n </li>\n\t\t\t \n
对此演示文稿表示歉意,但我在尝试从控制台复制时遇到了很多 Rstudio 崩溃的问题
有人可以在这里帮忙。也许read.table()
无论如何都是不正确的方法?