OrderCommunity {cheddar} | R Documentation

## Order a community

### Description

Order a `Community`.

### Usage

    OrderCommunity(community, ..., decreasing=FALSE, na.last = TRUE,
                   new.order=NULL, title=NULL)

### Arguments

`community` | an object of class `Community`.
`...` | the names of properties by which to order the communities.
`decreasing` | logical.
`na.last` | logical.
`new.order` | a vector of either node integer indices or node names giving the order.
`title` | the title of the new `Community`.

### Details

Returns a new `Community` object. `dots` can contain any name that meets the criteria of the `properties` parameter of `NPS`. If `new.order` is `NULL` then `...` and optionally `decreasing` are used to compute the new node ordering.

Different node orders will yield different `SumDietGaps` and `SumConsumerGaps` (e.g. Stouffer et al 2006, Zook et al 2011).

### Value

A `Community`.

### Author(s)

Lawrence Hudson

### References

Stouffer, D.B. and Camacho, J. and Amaral, L.A.N. (2006) Proceedings of the National Academy of Sciences of the United States of America 103, 50, 19015–19020.

Zook, A.E. and Eklof, A. and Jacob, U. and Allesina, S. (2011) Journal of Theoretical Biology 271, 1 106–113.

### See Also

`Community`, `order`, `Intervality`, `CollectionNPS`, `PreyAveragedTrophicLevel`, `PlotPredationMatrix`

### Examples

    data(TL84)
    NPS(TL84)

    # Order by increasing M
    TL84.increasing.M <- OrderCommunity(TL84, 'M', title='Increasing M')
    NPS(TL84.increasing.M)

    # Order by decreasing M
    TL84.decreasing.M <- OrderCommunity(TL84, 'M', decreasing=TRUE)
    NPS(TL84.decreasing.M)

    # Order by increasing M and N
    TL84.increasing.MN <- OrderCommunity(TL84, 'M', 'N')
    NPS(TL84.increasing.MN)

    # Reverse existing order
    TL84.reversed <- OrderCommunity(TL84, new.order=56:1)
    NPS(TL84.reversed)

    # Sort alphabetically by category and by increasing M within each category
    TL84.category <- OrderCommunity(TL84, 'category', 'M')

    # Increasing trophic level, then randomly sorted within trophic level
    new.order <- order(PreyAveragedTrophicLevel(TL84), sample(1:56))
    TL84.increasing.TL <- OrderCommunity(TL84, new.order=new.order,
                                         title='Increasing TL')
    NPS(TL84.increasing.TL)

    # Graphically show the effect of different orders
    par(mfrow=c(1,2))
    PlotPredationMatrix(TL84.increasing.M)
    PlotPredationMatrix(TL84.increasing.TL)

[Package cheddar version 0.1-633 Index]