Hi, I have a small simple data frame (attached) - to compare diversity of insects encountered in disturbed and unditurbed site. What i have is the count of insects - the total number of times they were encountered over 30 monitoring slots. Can someone please check for me to make sure how the 'community data matrix' for the diversity function needs to be oriented so that i'm comparing the right sets. I know that community data matrices mustn't carry characters that aren't numbers. I replaced my sps. names sp1, sp2, sp3, etc., with just 1, 2, 3.... but not sure what I can replace 'dist' and 'undist' with! I try this to start with -- insects.div<-diversity(insects, index="shannon")> insects.div[1] 0.7242788 0.7485246 0.7298712 0.9012085 1.0366280 0.9470281 1.0466542 [8] 1.0133127 0.6450332 & thats not what i want. Any advice on the matrix format or commands would be big help! Cheers, Manju V. Sharma Gardenwood East 3.1, Division of Biology, Imperial College London, Silwood Park Campus Ascot SL5 7PY UK Tel (O): 0044 207 5942360 (R): 0044 207 8520808 -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: insects.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081118/0e21e509/attachment.txt>
If all you have is species richness at each site, then you can't calculate diversity at all. You need to have the raw species abundance data. The data you provided is not a "community data matrix". The diversity function is doing exactly what it is supposed to: calculating the Shannon diversity for each row of the matrix. It assumes that sites are rows and columns are species. If the data frame contains all of the data you have available, then what you want to do is choose the appropriate test to compare species richnesses between paired disturbed and undisturbed habitats, and that problem has nothing to do with calculating diversities. Sarah On Tue, Nov 18, 2008 at 11:27 AM, Sharma, Manju <m.sharma05 at imperial.ac.uk> wrote:> Hi, > > I have a small simple data frame (attached) - to compare diversity of > insects encountered in disturbed and unditurbed site. What i have is > the count of insects - the total number of times they were encountered > over 30 monitoring slots. > > Can someone please check for me to make sure how the 'community data > matrix' for the diversity function needs to be oriented so that i'm > comparing the right sets. > > I know that community data matrices mustn't carry characters that aren't > numbers. I replaced my sps. names sp1, sp2, sp3, etc., with just 1, 2, > 3.... but not sure what I can replace 'dist' and 'undist' with! > > I try this to start with -- > insects.div<-diversity(insects, index="shannon") >> insects.div > [1] 0.7242788 0.7485246 0.7298712 0.9012085 1.0366280 0.9470281 > 1.0466542 > [8] 1.0133127 0.6450332 > > & thats not what i want. Any advice on the matrix format or commands > would be big help! > > Cheers, > > > > > Manju V. Sharma > Gardenwood East 3.1, Division of Biology, > Imperial College London, Silwood Park Campus > Ascot SL5 7PY > UK > Tel (O): 0044 207 5942360 > (R): 0044 207 8520808 >-- Sarah Goslee http://www.functionaldiversity.org
On Tue, 2008-11-18 at 16:27 +0000, Sharma, Manju wrote:> Hi, > > I have a small simple data frame (attached) - to compare diversity of > insects encountered in disturbed and unditurbed site. What i have is > the count of insects - the total number of times they were encountered > over 30 monitoring slots. > > Can someone please check for me to make sure how the 'community data > matrix' for the diversity function needs to be oriented so that i'm > comparing the right sets.Is this vegan::diversity ? If so, then it doesn't do what you are trying to do, nor does the help for diversity() say that it can do this. A community data matrix, as the example in ?diversity shows, is an n by m matrix of n samples and m species (n are the rows, m are the columns) containing counts/observations/proportions etc on the m species in each of the n samples. You need data on the species themselves, not counts of things in two or more different types of samples.> > I know that community data matrices mustn't carry characters that aren't > numbers. I replaced my sps. names sp1, sp2, sp3, etc., with just 1, 2, > 3.... but not sure what I can replace 'dist' and 'undist' with! > > I try this to start with -- > insects.div<-diversity(insects, index="shannon") > > insects.div > [1] 0.7242788 0.7485246 0.7298712 0.9012085 1.0366280 0.9470281 > 1.0466542 > [8] 1.0133127 0.6450332 > > & thats not what i want. Any advice on the matrix format or commands > would be big help!If you want to use vegan::diversity() then you'll need some different data. Alternatively, If you an try to explain what you want to do maybe we can point you in the right direction. G> > Cheers, > > > > > Manju V. Sharma > Gardenwood East 3.1, Division of Biology, > Imperial College London, Silwood Park Campus > Ascot SL5 7PY > UK > Tel (O): 0044 207 5942360 > (R): 0044 207 8520808 > ______________________________________________ > 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.-- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20081118/68850a22/attachment.bin>