当我尝试在网络应用上绘制地图时,我的闪亮应用程序出了问题我得到了这个
错误:参数长度为零
这是负责我服务器端地图绘制的部分
output$SentiMap <- renderPlot({
validate(
need(input$entity1 != "", 'Please enter a word')
)
LocTweet <- as.data.frame(entityscores(), optional = FALSE)
Loc <- as.data.frame(entity1(), optional = FALSE)
LocTweet$Loc <- Loc$V3
print(LocTweet)
#1-Collect only Negative tweets and put in new dataframe called Negative
AgainstTw <- LocTweet[(LocTweet$score == 'Against'),] #
#2-Callcolate the frequency of negative tweets fo each city
AgainstTw <- ddply(AgainstTw , .(AgainstTw$Loc), nrow)
names(AgainstTw) <- c("Location","Freq")
#3-Find lat and long for the cities founded in the tweets
city.limits <- geocode(as.character(AgainstTw$Location))
AgainstTw$lon <- city.limits$lon
AgainstTw$lat <- city.limits$lat
#5- we will repeat the same process for the SupportTW tweets
SupportTW <- LocTweet[(LocTweet$score == 'With'),]
SupportTW <- ddply(SupportTW , .(SupportTW$Loc), nrow)
names(SupportTW) <- c("Location","Freq")
city.limits <- geocode(as.character(SupportTW$Location))
SupportTW$lon <- city.limits$lon
SupportTW$lat <- city.limits$lat
map <- get_map(location = 'Middle East', zoom = 5)
#7 Plote the map with dots over the cities
print(ggmap(map) +
geom_point(aes(x = lon, y = lat, size = sqrt(AgainstTw$Freq)), data = AgainstTw, alpha = .7, col = "red")+##this one to plot the Negative tweets
geom_point(aes(x = lon, y = lat, size = sqrt(SupportTW$Freq)), data = SupportTW, alpha = .4, col = "green")##this one to plot the SupportTW tweets
))
})
我尝试了不同的方法但没有任何效果请帮助我。