read.compositional: Read a .csv file with compositional data

Description Usage Arguments Value Examples

View source: R/io.R

Description

Reads a data table containing compositional data (e.g. chemical concentrations)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
read.compositional(
  fname,
  method = NULL,
  colmap = "rainbow",
  sep = ",",
  dec = ".",
  row.names = 1,
  header = TRUE,
  check.names = FALSE,
  ...
)

Arguments

fname

a string with the path to the .csv file

method

either "bray" (for the Bray-Curtis distance) or "aitchison" (for Aitchison's central logratio distance). If omitted, the function defaults to 'aitchison', unless there are zeros present in the data.

colmap

an optional string with the name of one of R's built-in colour palettes (e.g., heat.colors, terrain.colors, topo.colors, cm.colors), which are to be used for plotting the data.

sep

the field separator character. Values on each line of the file are separated by this character.

dec

the character used in the file for decimal points.

row.names

a vector of row names. This can be a vector giving the actual row names, or a single number giving the column of the which contains the row names, or character string the name of the table column containing the row names.

header

a logical value indicating whether the file contains the names of the variables as its first line.

check.names

logical. If TRUE then the names of the variables in the frame are checked to ensure that they are syntactically variable names.

...

optional arguments to the built-in read.table function

Value

an object of class compositional, i.e. a list with the following items:

x: a data frame with the samples as rows and the categories as columns

method: either "aitchison" (for Aitchison's centred logratio distance) or "bray" (for the Bray-Curtis distance)

colmap: the colour map provided by the input argument

Examples

1
2
3
    fname <- system.file("Major.csv",package="provenance")
    Major <- read.compositional(fname)
    plot(PCA(Major))

provenance documentation built on May 5, 2021, 1:06 a.m.