marion howard
2015-Apr-01 21:04 UTC
[R] Error in dis[sppInSample,sppInSample]:subscript out of bounds
Hello, I am new to R and am encountering an error message that I cannot find a solution for. I am attempting to calculate MPD (mean pairwise distance), without weighting for abundance, with a community species list and a phylogenetic tree in newick format with branch lengths. I have read in both list and tree .txt files and calculated PD without any problem. To calculate MPD I have entered:>MPD1=mpd(list,cophenetic(tree)) Error:Error in dis[sppInSample, sppInSample] : subscript out of bounds Thank you for you helpCheersMarion. [[alternative HTML version deleted]]
MacQueen, Don
2015-Apr-01 23:43 UTC
[R] Error in dis[sppInSample, sppInSample]:subscript out of bounds
Before (I hope!) someone else answers in an unkind tone (and someone probably will), I have a few suggestions: 1) please use plain text email (an option somewhere in your email software). Using HTML email usually makes the email harder to read on r-help. 2) if at all possible, please try to construct an example that other people can easily run for themselves and provide the data. It makes it much easier to provide help. This may be hard for someone new to R, but it is worth it. The usual suggestion is to use the dput() function to include example data in your email (or the real data if there's not too much of it, and you are able to share). 3) please identify which packages your functions come from, since they are not (I believe) part of base R. Sometimes it is essential to also include the output of sessionInfo() 4) and check the posting guide mentioned at the bottom of the email for suggestions on how to ask a question so as to have the best chance of getting good answers. Expectation are pretty high on r-help. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 4/1/15, 2:04 PM, "marion howard" <marion.howard at hotmail.com> wrote:>Hello, >I am new to R and am encountering an error message that I cannot find a >solution for. >I am attempting to calculate MPD (mean pairwise distance), without >weighting for abundance, with a community species list and a phylogenetic >tree in newick format with branch lengths. >I have read in both list and tree .txt files and calculated PD without >any problem. >To calculate MPD I have entered:>MPD1=mpd(list,cophenetic(tree)) >Error:Error in dis[sppInSample, sppInSample] : subscript out of bounds >Thank you for you helpCheersMarion. > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.
John Kane
2015-Apr-02 15:08 UTC
[R] Error in dis[sppInSample, sppInSample]:subscript out of bounds
As a follow-up to Don's reply have a look at https://github.com/hadley/devtools/wiki/Reproducibility and/or ttp://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example for some useful suggestions on how to frame a question. If you need to include sample data with your reply please read carefully about the dput function and supply your data in dput() format. John Kane Kingston ON Canada> -----Original Message----- > From: marion.howard at hotmail.com > Sent: Thu, 2 Apr 2015 07:04:50 +1000 > To: r-help at r-project.org > Subject: [R] Error in dis[sppInSample,sppInSample]:subscript out of > bounds > > Hello, > I am new to R and am encountering an error message that I cannot find a > solution for. > I am attempting to calculate MPD (mean pairwise distance), without > weighting for abundance, with a community species list and a phylogenetic > tree in newick format with branch lengths. > I have read in both list and tree .txt files and calculated PD without > any problem. > To calculate MPD I have entered:>MPD1=mpd(list,cophenetic(tree)) > Error:Error in dis[sppInSample, sppInSample] : subscript out of bounds > Thank you for you helpCheersMarion. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.____________________________________________________________ FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family! Visit http://www.inbox.com/photosharing to find out more!
Andrew Park
2015-Aug-21 18:59 UTC
[R] Error in dis[sppInSample, sppInSample]:subscript out of bounds
I'm pretty sure you are using the package Picante. When I received the error you described in my own project, it was due to the naming of species in the community matrix and the phylogenetic tree being slightly different (one separated latin binomials with a space, the other with an underscore). When I corrected one set of names (using gsub) to be identical to the other then the error went away. I hope this helps. -- View this message in context: http://r.789695.n4.nabble.com/Error-in-dis-sppInSample-sppInSample-subscript-out-of-bounds-tp4705418p4711366.html Sent from the R help mailing list archive at Nabble.com.