Graph question
Georgina Sarah Humphreys wrote:
If I have a set of data comprising a list of numbers of eggs on mosquito guts that range from 1 to 157. How can I get R to draw a barchart of the distribution of the data (i.e. x axis= number of eggs on a gut, y axis=number of mosquitoes found with that number of eggs)? Data is listed below. Thanks, Georgina Number of eggs on each mosquito gut: [1] 1 1 1 1 4 2 1 12 12 1 2 1 12 6 11 33 33 94 17 [20] 3 14 12 54 1 16 10 7 12 4 7 22 1 34 2 11 34 22 27 [39] 4 1 27 1 1 157 1 7 31 3 6 24 6 7 23 10 54 3 12 [58] 12 5 2 27 2 7 6 84 3 68 1 4 6 41 1 50 27 30 14 [77] 3 1 1 1 30 1 68 1 7 1 10 5 11 4 19 1 7 9 33 [96] 2 33 57 12 6 2 57 3 115 19 22 10 19 6 11 30 57 4
Hi Georgina, Here's one way: # first I created a vector named neggs with your data above eggfreq<-freq(neggs) library(plotrix) barp(eggfreq[[1]],names.arg=names(eggfreq[[1]]), xlab="Number of eggs",ylab="Frequency", main="Eggs on mosquito guts") Jim