我是R編程新手,嘗試加載簡單的XML。我試圖將XML加載到DataFrame中R
data <- xmlToDataFrame("temp.xml")
,但得到這個錯誤
Error in xmlToDataFrame(xmlParse(doc), colClasses, homogeneous, collectNames, : error in evaluating the argument 'doc' in selecting a method for function 'xmlToDataFrame': Error: XML content does not seem to be XML: 'temp.xml'`
XML模式
<root>
<row Id="1" UserId="1" Name="Rohit" Date="2009-06-29T10:28:58.013" />
<row Id="2" UserId="3" Name="Rohit" Date="2009-06-29T10:28:58.030" />
</root>
我也試過:
xml <- xmlParse("temp.xml")
輸出:
Error: XML content does not seem to be XML: 'temp.xml'
我的XML文件位於相同的工作目錄中。
此外,如果你想嘗試,我已經上傳了示例XML這裏:http://www4.ncsu.edu/~rkandha/temp.xml
請提供哪些功能,我應該在這裏使用了一些方向。
請發表您的代碼。 – zero323
已更新。儘管我還沒做過什麼重要的事情。 – Rohit
'as.data.frame(xmlToList(xml))' – Ramnath