Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

oneOrDataset

Treating single compositions as one-row datasets


Description

A dataset is converted to a data matrix. A single data item (i.e. a simple vector) is converted to a one-row data matrix.

Usage

oneOrDataset(W,B=NULL)

Arguments

W

a vector, matrix or dataframe

B

an optional second vector, matrix or data frame having the intended number of rows.

Value

A data matrix containing the same data as W. If W is a vector it is interpreded as a single row. If B is given and length(dim(B))!= 2 and W is a vector, then W is repeated nrow(B) times.

Author(s)

K.Gerald v.d. Boogaart http://www.stat.boogaart.de

Examples

oneOrDataset(c(1,2,3))
oneOrDataset(c(1,2,3),matrix(1:12,nrow=4))
oneOrDataset(data.frame(matrix(1:12,nrow=4)))

compositions

Compositional Data Analysis

v2.0-1
GPL (>= 2)
Authors
K. Gerald van den Boogaart <boogaart@hzdr.de>, Raimon Tolosana-Delgado, Matevz Bren
Initial release
2021-01-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.