[R-sig-phylo] error with pd for phylogenetic diversity

Steve Kembel steve.kembel at gmail.com
Thu Dec 10 18:43:29 CET 2009


Hi Marten,
your colleague contacted me on the picante forums about this issue,
I'll keep future discussion of the problem there:
https://r-forge.r-project.org/forum/forum.php?thread_id=2010&forum_id=408
I have not encountered that error before and would need to see the
data to diagnose it. It may be related to empty rows or columns in the
community matrix.
Thanks,
Steve

On Thu, Dec 10, 2009 at 12:26 AM, Marten Winter <marten.winter at ufz.de> wrote:
> Heja,
> I've a colleague facing a problem with pd...so I forward her problem. Please, if you can help send your answer(s) to me.
>
> Many thanks!
> cheers,
> M.
>
> Dear R-users,
>
> I am experiencing a problem using the function pd from the package
> picante. The function calculates Faith's PD (phylogenetic diversity).
> I have a phylogeny that looks like this:
>
> str(phy.uncult)
> List of 5
>  $ edge       : num [1:191, 1:2] 124 125 126 127 128 129 130 131 131 132 ...
>  $ Nnode      : int 69
>  $ tip.label  : chr [1:123] "Malva_neglecta" "Acer_negundo"
> "Rhus_glabra" "Toxicodendron_radicans" ...
>  $ edge.length: num [1:191] 5 2 3 1 1 ...
>  $ node.label : chr [1:69] "euphyllophyte" "monocotneudicot" "eudicot"
> "ber2ast" ...
>  - attr(*, "class")= chr "phylo"
>  - attr(*, "order")= chr "cladewise"
>
>
> And I have a presence-absence matrix that looks like this:
>
> str(x.nauto.presabs)
> 'data.frame':   119 obs. of  29 variables:
>  $ Amaranthus_retroflexus : int  0 0 0 0 0 0 0 0 0 0 ...
>  $ Amaranthus_spinosus    : int  0 0 0 0 0 0 0 0 0 0 ...
>  $ Arctium_minus          : int  0 0 0 0 0 0 0 0 0 0 ...
>  $ Capsella_bursa-pastoris: int  0 1 0 0 1 1 0 0 0 1 ...
>  $ Chenopodium_album      : int  1 1 0 1 1 1 1 1 0 1 ...
>  $ Cirsium_arvense        : int  0 0 0 0 1 0 1 1 0 0 ...
>  $ Convolvulus_arvensis   : int  1 0 0 0 0 0 0 0 0 0 ...
> etc.
>
> When applying the pd-function: pd.nauto<-pd(x.nauto.presabs, phy.uncult,
> include.root=TRUE), I get the following error:
> Error in data.frame(PD = PDs, SR = SR) :
>   arguments imply differing number of rows: 125, 119
>
> If I do the same calculation with another presence-absence matrix, which
> has the same structure as the oen shown above, just containing other
> species and having other dimensions (133 obs. of  56 variables), the
> function works without giving an error. If I say include.root=FALSE, it
> works as well, but I do not want to exclude the root.
> I have no idea, why it does not work and I could not find any help in
> R/internet/literature. As both PD and SR (species richness) are
> calculated from the same matrix, they should end up with the same number
> of rows - but it seems, they don't do so. Maybe one of you came across
> the same problem and found a solution? That would be great, I'd really
> appreciate your help!
>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-phylo mailing list
> R-sig-phylo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>
>



-- 
______________________________________________
Dr. Steven Kembel - steve.kembel at gmail.com
http://www.phylodiversity.net/skembel/



More information about the R-sig-phylo mailing list