nID_nSp: [+!] Calculate number and percentage of unique IDs and...

View source: R/nID_nSp.R

nID_nSpR Documentation

[+!] Calculate number and percentage of unique IDs and observations

Description

Calculate number and percentage of unique IDs and observations.

number(IDs) >= number(observations)

# DEFAULT BEHAVIOUR OF FUNCTION CHANGED

Usage

nID_nSp(
  data = NULL,
  ID,
  gr,
  ID_text = "medical specimens",
  observation_text = "spectra",
  decimals = 1
)

nID_nObs(
  data = NULL,
  ID,
  gr,
  ID_text = "unique IDs",
  observation_text = "observations"
)

Arguments

data

A data frame with variables, that names are denoted by ID and gr

ID

Vector with speciment IDs (Either a vector or a variable name in data).

gr

Vector with speciment groups (Either a vector or a variable name in data).

ID_text

A title for unique IDs, that apear in the table.

observation_text

A title for observations, that apear in the table.

decimals

A number of maximum decimal places in percentages. This parameter is passed to function round. Default is 0.

Value

Table (data frame) with count and percentages.

Author(s)

Vilmantas Gegzna

Examples

data(DataSet1)

nID_nSp(DataSet1, "ID", "gr")
nID_nSp(ID = DataSet1$ID, gr = DataSet1$gr)
pander::pander(nID_nSp(DataSet1, "ID", "gr"))

nID_nObs(DataSet1, "ID", "gr")
pander::pander(nID_nObs(DataSet1, "ID", "gr"))

# For hyperSpec object
nID_nSp(Spectra2$.., ID = "class", "gr")


GegznaV/spHelper documentation built on April 16, 2023, 1:42 p.m.