Ich lerne R mit "Data Mashups in R" und ich kann nicht das Beispiel auf p. 5 zu arbeiten. Der Code, den ich verwenden, ist dies:Daten Mashups in R: "Index außerhalb der Grenzen"
# Install and load RCurl
install.packages("RCurl")
library("RCurl")
# Install and load the XML package
install.packages("XML")
library("XML")
# Download file and parse it
appid<- 'ucVVQzLV34GQR4ppLwbdW6G8cCSZDoCBqAc53NXsWB3gXkmP1I4epLwMxboV.PfADi_2ubr2A7Cg8FO4Z3xVxxujza2FJ 8M-'
street<-"11408 Bellflower Road"
RCurl<-paste(
"http://local.yahooapis.com/MapsService/V1/geocode?appid=",
appid,
"&street=",
URLencode(street),
"&city=Cleveland&state=OH"
,sep="")
#xmlResult<-xmlTreeParse(requestUrl,isURL=TRUE)
xmlResult<-xmlTreeParse(getURL(RCurl))
#Print the output
str(xmlResult)
Aber wenn ich das tue ich nicht bekommen das folgende Ergebnis:
List of 2
$ doc:List of 3
..$ file :List of 2
.. ..$ text : Named list()
.. .. ..- attr(*, "class")= chr [1:5] "XMLTextNode" "XMLNode" "RXMLAbstractNode" "XMLAbstractNode" ...
.. ..$ Message:List of 1
.. .. ..$ text: Named list()
.. .. .. ..- attr(*, "class")= chr [1:5] "XMLTextNode" "XMLNode" "RXMLAbstractNode" "XMLAbstractNode" ...
.. .. ..- attr(*, "class")= chr [1:4] "XMLNode" "RXMLAbstractNode" "XMLAbstractNode" "oldClass"
.. ..- attr(*, "class")= chr [1:4] "XMLNode" "RXMLAbstractNode" "XMLAbstractNode" "oldClass"
..$ version : Named list()
.. ..- attr(*, "class")= chr [1:5] "XMLCommentNode" "XMLNode" "RXMLAbstractNode" "XMLAbstractNode" ...
..$ children:
Error in x$children[[...]] : subscript out of bounds
Was mache ich falsch?
Nichts, möglicherweise. Die URL scheint einen 404-Fehler zurückzugeben, also vielleicht falsch oder veraltet? – joran