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

View source: R/io.R

read.varietalR Documentation

Read a .csv file with varietal data

Description

Reads a data table containing compositional data (e.g. chemical concentrations) for multiple grains and multiple samples

Usage

read.varietal(
  fname,
  snames = NULL,
  sep = ",",
  dec = ".",
  method = "KS",
  check.names = FALSE,
  row.names = 1,
  ...
)

Arguments

fname

file name (character string)

snames

either a vector of sample names, an integer marking the length of the sample name prefix, or NULL. read.varietal assumes that the row names of the .csv file consist of character strings marking the sample names, followed by a number.

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.

method

an optional string specifying the dissimilarity measure which should be used for comparing this with other datasets. Should be one of either "KS" (for Kolmogorov-Smirnov) or "Kuiper" (for Kuiper)

check.names

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

row.names

logical. See the documentation for the read.table function.

...

optional arguments to the built-in read.csv function

Value

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

x: a compositional data table

snames: a vector of strings corresponding to the sample names

name: the name of the dataset, extracted from the file path

Examples

fn <- system.file("SNSM/Ttn_chem.csv",package="provenance")
Ttn <- read.varietal(fname=fn,snames=3)
plot(MDS(Ttn))

provenance documentation built on Aug. 28, 2023, 5:07 p.m.