Write Report of an Object of Class 'mefa' into File
report.mefa.Rd
The data of the 'mefa' object is written into a file in a standard format used by most local journals for publishing distribution data of organisms. The aim is to provide an exporting facility that can directly be used for generating reports, parts of research papers, or supplementary materials.
Usage
report(x, ...)
# S3 method for mefa
report(x, filename, segment = FALSE, n = NULL,
by.taxa = TRUE, samp.var = NULL, drop.redundant = NULL,
collapse = TRUE, taxa.name = NULL, author.name = NULL,
taxa.order = NULL, grouping = FALSE, tex = FALSE, binary = FALSE,
tex.control = list(ital.taxa = TRUE, noindent = TRUE,
bold.sect = TRUE, bold.1st = TRUE, vspace1 = 0.5, vspace2 = 0.2),
sep = c(",", ":", "(", ":", ",", ")", ";"), dir = getwd(), ...)
Arguments
- x
an object of class 'mefa'.
- filename
character, the name of the file to be written into the working directory or a directory defined by the
outdir
argument.- segment
logical, if
NULL
(default) segments are not distinguished in the output. IfTRUE
all (n = NULL
) or some of the segments are used and distinguished.- n
segments to be used. If
NULL
all segments are used, if notNULL
, give names of the segments to be used (only ifsegment = TRUE
).- by.taxa
logical, whether the main sectioning should be made according to taxa (
TRUE
, default) or samples (FALSE
, currently not implemented).- samp.var
variables in the samples table (
x$samp
) to be used in the report. Variables appear in the order given here.- drop.redundant
logical, whether redundant elements should be dropped (an integer up to
length(samp.var)-1
) or not (NULL
, default).- collapse
logical, if
TRUE
samples with identical values insamp.var
for a given species are collapsed to avoid redundancy.- taxa.name
column in the taxa table (
x$taxa
) where the taxa names are stored. By default (NULL
)dimnames(x)$taxa
is used.- author.name
column in the taxa table (
x$taxa
) where the authors' names and dates of descriptions are stored. By default it is not used (NULL
). If specified, these follow the species names in the report.- taxa.order
column in the taxa table (
x$taxa
) where the variable for ordering is stored. By default (NULL
)taxa.name
is used for ordering.- grouping
logical, whether all records of a given species should be collapsed into single paragraph without grouping (
FALSE
, default), or grouped into separate paragraphs (TRUE
).- tex
logical, whether to generate formatted LaTeX output (
TRUE
) or plain text file (FALSE
).- binary
logical, if
TRUE
the result will contains count data.- tex.control
a list with LaTex formatting options (if
tex = TRUE
). Theital.taxa
controls italicised taxa names,noindent
controls indentation of paragraphs,bold.sect
controls boldface type of paragraph openings,bold.1st
controls the boldface type of first elements of each record of a given species,vspace1
controls the space between species blocks,vspace2
controls the space between paragraphs of the same species (ifgouping = FALSE
).- sep
character vector of length 7. The 1st separates values in
samp.var
, 2nd is placed between values ofsamp.var
if redundant elements were dropped, 3rd is the opening character before count data, 4th stands after the segment name, 5th separates values of segments, 6th is the closing character after the count data, 7th separates the records.- dir
character, full path of the directory where the file should be written (working directory is then restored). If
NULL
, the current working directory is used.- ...
further arguments potentially passed (currently there are none).
Details
The resulting file can be recycled by copy-and-pasting into a document (if tex = FALSE
) or be included into a LaTeX report (e.g. via the package Sweave
, see mefadocs("SampleReport")
). Contrary to the many arguments, the default values do not need much modifications in most of the cases (see examples).
References
S\'olymos P. (2008) mefa: an R package for handling and reporting count data. Community Ecology 9, 125--127.
S\'olymos P. (2009) Processing ecological data in R with the mefa package. Journal of Statistical Software 29(8), 1--28. doi:10.18637/jss.v029.i08
Author
P\'eter S\'olymos, solymos@ualberta.ca
Examples
data(dol.count, dol.samp, dol.taxa)
x <- mefa(stcs(dol.count), dol.samp, dol.taxa)
if (FALSE) {
## Plain text
## Count values from x$xtab
report(x, "report-all.txt")
## Count values for each segments
report(x, "report-segm-all.txt",
samp.var = c("method","microhab"), segment = TRUE)
## LaTeX formatting
report(x, "report-all.tex", tex=TRUE)
## For how to include into a TeX or Rnw file, see:
mefadocs("SampleReport")
}