I have a dataset with animal trappings, where in each location I have multiple animals of several different species captured. I would like to plot this information on a map, such that each point would represent location of trapping of a given species and the size of each point would represent a number of animals of this species trapped in this location. I can do all this except the last point, differentiating point size depending on the counts in each category and location.
Data:
> test
Species Location Long Lat
1 Species1 Location4 13.179328 32.83438
2 Species1 Location4 13.179328 32.83438
3 Species1 Location4 13.179328 32.83438
4 Species1 Location4 13.179328 32.83438
5 Species1 Location4 13.179328 32.83438
6 Species1 Location4 13.179328 32.83438
7 Species1 Location4 13.179328 32.83438
8 Species1 Location4 13.179328 32.83438
9 Species1 Location4 13.179328 32.83438
10 Species1 Location4 13.179328 32.83438
11 Species1 Location4 13.179328 32.83438
12 Species1 Location4 13.179328 32.83438
13 Species1 Location4 13.179328 32.83438
14 Species1 Location4 13.179328 32.83438
15 Species1 Location2 13.857541 32.71680
16 Species1 Location2 13.857541 32.71680
17 Species1 Location2 13.857541 32.71680
18 Species1 Location1 7.584970 33.77976
19 Species1 Location1 7.564263 33.81079
20 Species1 Location1 7.555380 33.79994
21 Species2 Location1 7.542248 33.79943
22 Species2 Location1 7.562118 33.79340
23 Species2 Location1 7.542248 33.79943
24 Species2 Location1 7.555380 33.79994
25 Species2 Location1 7.542248 33.79943
26 Species2 Location3 11.377850 33.20891
27 Species2 Location3 11.377850 33.20891
28 Species2 Location3 11.377850 33.20891
29 Species2 Location3 11.377850 33.20891
30 Species2 Location3 11.377850 33.20891
31 Species1 Location2 13.834581 32.72319
32 Species1 Location2 13.834581 32.72319
33 Species1 Location2 13.834581 32.72319
34 Species1 Location2 13.834581 32.72319
35 Species1 Location2 13.834581 32.72319
36 Species1 Location2 13.834581 32.72319
37 Species1 Location2 13.834581 32.72319
38 Species1 Location2 13.834581 32.72319
39 Species1 Location2 13.834581 32.72319
40 Species1 Location2 13.834581 32.72319
41 Species1 Location2 13.834581 32.72319
42 Species1 Location2 13.834581 32.72319
43 Species1 Location2 13.834581 32.72319
44 Species1 Location2 13.834581 32.72319
45 Species1 Location2 13.834581 32.72319
46 Species1 Location2 13.834581 32.72319
47 Species1 Location2 13.834581 32.72319
48 Species1 Location2 13.834581 32.72319
49 Species1 Location2 13.834581 32.72319
50 Species1 Location2 13.834581 32.72319
> tapply(test$Species,test$Location,length)
Location1 Location2 Location3 Location4
8 23 5 14
Standard ggmap plot:
m<-get_map(location=c(lon=10.6858397, lat=32.7996318), zoom=7, color="bw")
ggmap(m, extent = "normal") +
geom_point(aes(x = Long, y = Lat, colour = Species, size = 2), data = test)
How do I now change the size of the point depending on how many animals of each species were captured in a location?