1

R の googleVis パッケージを使用して世界銀行のデータをプロットしようとしていますが、次のエラーが表示されます。

In if (class(x[[.x]]) == "Date") as.character(x[[.x]]) else x[[.x]] :
the condition has length > 1 and only the first element will be used

次のコードを使用しました。

# load the packages
library(WDI) # package for importing World Bank data
library(plm) # package for working with panel data
library(googleVis) # the googleVis package

# import the data using the WDI package
LONG <- WDI(country=c("AGO","BEN","BWA","BFA","BDI"), indicator=c("SP.DYN.CBRT.IN",
"SP.DYN.TFRT.IN", "SP.POP.TOTL", "NY.GDP.PCAP.KN"), start=2005, end=2009, 
extra=FALSE)

# transform to panel format and encode the year variable as numeric
PANEL <- pdata.frame(LONG, c("country","year"))
PANEL$year <- as.numeric(as.character(PANEL$year))

# plot in a MotionChart using googleVis
MC <- gvisMotionChart(PANEL, idvar="country", timevar="year")
plot(MC)

これがなぜなのか誰か知っていますか?

4

1 に答える 1