read.community: Read in sparse community matrices

Description Usage Arguments Value Examples

View source: R/community.R

Description

read.community reads in file containing occurrence data and returns a sparse matrix.

Usage

1
read.community(file, grids = "grids", species = "species", ...)

Arguments

file

A file name.

grids

Column name of the column containing grid cells.

species

Column name of the column containing the species / taxa names.

...

further arguments passed to or from other methods.

Value

read.community returns a sparse matrix (an object of class "dgCMatrix").

Examples

1
2
3
4
5
6
7
8
df <- data.frame(grids=paste0("g", c(1,1,2,3,3)),
                 species = paste0("sp", c(1,3,2,1,4)))
df
tmp <- tempfile()
write.csv(df, tmp)
(M <- read.community(tmp) )
sparse2long(M)
unlink(tmp)

phyloregion documentation built on May 1, 2021, 9:06 a.m.