googleVis の gvisGeoMap() を使用してマップを作成しようとすると、次のエラーが発生します。
## Using the google visualization API with R
library(googleVis)
input<- read.csv("data.csv")
select<- input[which(input$Subgroup=="Total 5-14"),]
select<- input[which(input$Subgroup=="Total 5-14 yr"),]
Map<- data.frame(select$Country.or.Area, select$Value)
names(Map)<- c("Country", "Percentage")
Geo=gvisGeoMap(Map, locationvar="Country", numvar="Percentage",
options=list(height=350, dataMode='regions'))
plot(Geo)
#starting httpd help server ... done
#Error in ifelse(interactive(), getOption("browser"), "false") :
#replacement has length zero
上記は「RGui」でのエラーです。「RStudio」のエラーメッセージは異なります:
#object of type 'closure' is not subsettable
ブラウザはまったく起動しません。単純にヘルプ ページを呼び出すことができるため、HTTP サーバーは正常に動作します (たとえば、?googleVis はブラウザを起動してヘルプ ページを表示します)。上記のコードの「Geo」オブジェクトは問題なく、plot() が想定されていることを実行しない html コードのみが含まれています (temp フォルダー内の html ファイルを手動で実行して、結果を確認できます)。上記の例は、こちらから入手できます。
手がかりをいただければ幸いです。
ありがとうございました