CommunityCollection {cheddar} | R Documentation

## Collections of communities

### Description

Collections of communities

### Usage

    CommunityCollection(communities)
    ## S3 method for class 'CommunityCollection'
    print(x, ...)
    ## S3 method for class 'CommunityCollection'
    plot(x, ncol=min(length(x),5), by.col=TRUE,
         plot.fn=plot, ...)
    ## S3 method for class 'CommunityCollection'
    summary(object, ...)

### Arguments

`communities` | a `list` of `Community` objects.
`x` | an object of class `CommunityCollection`.
`object` | an object of class `CommunityCollection`.
`ncol` | the number of columns in the plot.
`by.col` | logical - if `TRUE` communities are plotted along columns.
`plot.fn` | a plot function that accepts a `Community` obejct .
`...` | further arguments passed to other methods.

### Details

Constructs a new `CommunityCollection` from a list of existing `Community` objects. `CommunityCollection` is a subclass of `list`. `CommunityCollection` objects can not be modified directly.

An error is raised if any `Community` objects in `communities` share the same ‘title’ community property. An error is also raised if the `Community` objects in `communities` do not all have the same value of the community properties ‘M.units’ and ‘N.units’. `CommunityCollection` places no restrictions on other properties. For example, all of the ten communities with the `pHWebs` collection has a valid pH property but this is not enforced by `CommunityCollection` - it would be possible for a `Community` within a collection to not have a pH property, to have a pH of `NA` or even to have an invalid pH, for example a negative value.

`CommunityCollection` supports standard generic functions `plot`, `print`, `subset` and `summary`.

### Value

A new object of class `CommunityCollection`.

### Author(s)

Lawrence Hudson

### See Also

`Community`, `CollectionCPS` `CollectionNPS` `CollectionTLPS`, `OrderCollection`, `subset.CommunityCollection`, `AggregateCommunitiesBy`, `AggregateCommunities`, `pHWebs`

### Examples

    # 10 stream webs sampled over a wide pH gradient
    data(pHWebs)
    pHWebs

    # Eyeball the webs
    plot(pHWebs)

    # Consistent axis limits
    plot(pHWebs, xlim=c(-14,6), ylim=c(-3,13))

    # Different plot function
    plot(pHWebs, plot.fn=PlotWebByLevel, ylim=c(1,4.5))

    # list-like operations
    length(pHWebs)
    sapply(pHWebs, 'NumberOfTrophicLinks')
    pHWebs[['Broadstone']]  # Access the Community

    # A new CommunityCollection containing every other ph web
    pHWebs[seq(1, 10, by=2)]

    # A new CommunityCollection containing two webs
    pHWebs[c('Old Lodge','Bere Stream')]

    # CollectionCPS gets community properties
    CollectionCPS(pHWebs)   # Webs are sorted by increasing pH

    # Order by decreasing pH
    pHWebs.decreasing.pH <- OrderCollection(pHWebs, 'pH', decreasing=TRUE)
    CollectionCPS(pHWebs.decreasing.pH)

    # Order by name
    pHWebs.name <- OrderCollection(pHWebs, 'title')
    CollectionCPS(pHWebs.name, c('pH', 'NumberOfNodes'))

    # The following will always be TRUE.
    all(FALSE==duplicated(names(pHWebs)))

    # A new collection of the two Tuesday Lake communities
    data(TL84, TL86)
    BothTL <- CommunityCollection(list(TL84, TL86))
    CollectionCPS(BothTL)

    # You can't modify CommunityCollections
    ## Not run: pHWebs[1] <- 'silly'

[Package cheddar version 0.1-633 Index]