nature.variables: nature.variables

View source: R/mix.data.R

nature.variablesR Documentation

nature.variables

Description

Splits a data matrix according to the detected nature of variables. Columns of class integer are considered quantitative (num). Character of factor are consider qualitative (nom). Warning, ordinal variables can not be detected by this function, and must be manually indicated by the user.

Usage

nature.variables(data, print.nature = TRUE)

Arguments

data

a data frame with n rows (individuals) and p columns (numeric, nominal and/or ordinal variables)

print.nature

boolean (default = TRUE), if TRUE results are printed.

Value

  • data.numeric : data.frame with numeric variables

  • p.numeric : columns index of numeric variables

  • nb.numeric : number of numeric variables

  • data.quali : data.frame with numeric variables

  • p.quali : columns index of numeric variables

  • nb.quali : number of numeric variables

Examples

data (antibiotic)
res.mix <- PCA.OS::nature.variables(antibiotic)
res.mix$p.numeric
head(res.mix$data.numeric)
res.mix$p.quali
head(res.mix$data.quali)
nature <- rep(NA,ncol(antibiotic)) #Setting nature argument for PCAOS function
nature[res.mix$p.numeric] <- "num"
nature[res.mix$p.quali] <- "nom"
  nature[2] <- "ord"


martinparies/PCAOS documentation built on March 15, 2023, 7:19 a.m.