Learn R Programming

provenance (version 0.6)

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

Description

Reads a data table containing categorical data (e.g. petrographic, heavy mineral or geochemical data)

Usage

read.compositional(fname, method = NULL, colmap = "rainbow")

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.

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)

Examples

Run this code
fname <- system.file("Major.csv",package="provenance")
Major <- read.compositional(fname)
plot(PCA(Major))

Run the code above in your browser using DataLab