我试图根据他们的情绪在世界地图上用颜色绘制推文。我知道它应该很容易做到,但我正努力让它发挥作用。当我尝试查看地图时,它给出了错误:"错误:提供给连续刻度的离散值"
#if(tweet.sentiment=="positive") {
# mp = mp + geom_point(aes(x=tweet.x, y=tweet.y), colour = "blue", size=3)
#} else if(tweet.sentiment=="neutral") {
# mp = mp + geom_point(aes(x=tweet.x, y=tweet.y), colour = "grey90", size=3)
#} else {
# mp = mp + geom_point(aes(x=tweet.x, y=tweet.y), colour = "darkorange1", size=3)
#}
mp <- mp + geom_point(aes(x=tweetData$tweet.x, y=tweetData$tweet.y, colour=tweetData$tweet.sentiment), size=3)
mp
Here's a sample of tweetData
tweet.x tweet.y tweet.sentiment
1 -78.9429329 43.897545 negative
2 106.8227450 -6.174465 neutral
3 -84.3879824 33.748995 neutral
4 -118.2436849 34.052234 negative
5 -81.5157535 27.664827 positive
6 -88.7878678 43.784440 positive
7 -74.4056612 40.058324 negative
8 -95.7128910 37.090240 neutral
9 -80.8431267 35.227087 positive