Learn R Programming

ClustMMDD (version 1.0.4)

dataR2C: Transform a (normal) data frame to be compatible with ClustMMDD main functions

Description

dataR2C(x, ploidy) returns a list.

Usage

dataR2C(x, ploidy = 1)

Arguments

x
A data frame or a matrix with the number of columns equal to $number(variables)*ploidy$.
ploidy
The number of unordered observations represented by a string in xdata. For example, for genotypic data from diploid individual, $ploidy = 2$ : two columns for one variable.

Value

A list of elements needed for ClustMMDD main functions :
  • data : A matrix compatible with ClustMMDD main functions.
  • ploidy : The number of columns for each variable. It is the ploidy for genotypic data
  • N : The number of lines in x.
  • P : The number of categorical variables describing the dataset : $P = ncol(x)/ploidy$.
  • N_LEVELS : The vector of the numbers of levels for the variables.
  • LEVELS : The levels for the variables.
  • COUNT : The observed counts of the levels.
  • FREQ : The observed frequencies.

See Also

cutEachCol in ClustMMDD package.

Examples

Run this code
data(genotype1)
head(genotype1)
genotype2 = cutEachCol(genotype1[, -11], 2)
head(genotype2)
genotype3 = dataR2C(genotype2, ploidy = 2)
head (genotype3$data)
str(genotype3)

Run the code above in your browser using DataLab