prep_pcord: Prepare data for PC-ORD

Description Usage Arguments Details Value References Examples

Description

Prepare data for export to PC-ORD (>= 5.0), with required formats and column headers.

Usage

1
prep_pcord(x, filename = NULL, outdir = getwd(), header = TRUE, ...)

Arguments

x

array of species or environmental data, where rows = SUs and row.names = SU identifiers.

filename

string, name for new file; if NULL then returns an R object; if file already exists then a timestamp is added.

outdir

string, directory to which file will be written.

header

logical, add a PC-ORD header?

...

further arguments passed to other methods.

Details

Writes a file compatible with PC-ORD (McCune and Mefford 2011), and automates the addition of a PC-ORD header. Empty cells not allowed. Column names longer than 10 characters are automatically abbreviated to unique 10-char names; PC-ORD abbreviates but doesn't check for duplicates.

In R first call prep_pcord(header = TRUE), then in PC-ORD do: File > Import > Main matrix > Excel spreadsheet ( with PC-ORD header).

Value

.xls file (optionally an R object) with automatic PC-ORD header.

References

McCune, B., and M. J. Mefford. 2011. PC-ORD. Multivariate Analysis of Ecological Data. Version 6. MjM Software Design, Gleneden Beach, OR.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# species abundance data
spe <- data.frame(matrix(rnorm(9, 10), 3, 3))
colnames(spe) <- c("Acer rubrum",
                   "Acer saccharum",
                   "Acer saccharinum")
lookin <- getwd()
prep_pcord(spe, filename="spe_example", outdir=lookin)

# environmental data including some factors
env <- data.frame(soil = c("A","B","D"),
                  aspect = c("N","S","SE"),
                  slope = c(1,17,9))
prep_pcord(env, filename="env_example", outdir=lookin)

# header not strictly required
prep_pcord(env, filename="env_example", outdir=lookin, header=FALSE)

# allows no element to be empty or NA
env[2,3] <- NA
### NOT RUN:
# prep_pcord(env, filename="env_example", outdir=lookin)
### END NOT RUN

# allows only xls output
### NOT RUN:
# prep_pcord(env, filename="env_example.csv", outdir=lookin)
### END NOT RUN

phytomosaic/ecole documentation built on Jan. 2, 2022, 11:24 p.m.