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 PhD Student Division of Infection and Immunity B5-29, GBRC 120 University Place Glasgow G12 8TA Tel: 0141 330 5650
look at histogram and densityplot in the lattice package On Wed, Sep 24, 2008 at 9:26 AM, Georgina Sarah Humphreys <g.humphreys.1 at research.gla.ac.uk> 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 > > PhD Student > Division of Infection and Immunity > B5-29, GBRC > 120 University Place > Glasgow > G12 8TA > Tel: 0141 330 5650 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis
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