count_spectra: Summary statistics of factor variable in a hypecSpec object...

View source: R/count_spectra.R

count_spectraR Documentation

Summary statistics of factor variable in a hypecSpec object by ID

Description

Summary statistics of factor variable in a hypecSpec object by ID

Usage

count_spectra(
  OBJ,
  Var = NULL,
  ID = "ID",
  decimals = 1,
  include_na = TRUE,
  na_level = "(Missing)",
  na.rm = TRUE,
  total = FALSE
)

Arguments

OBJ

hyperSpec object

Var

(string) variable name of factor variable

ID

(string) variable name of ID variable

decimals

(integer) number of decimals to round to calculating the percentages. Default is 2.

include_na

(logical) If TRUE, NA values are included.

na_level

(character) Name for the level, which represents NA value.

na.rm

(logical) used by function sum(). Default is TRUE.

FALSE

(logical) Add row with "total".

Value

a data frame with counts and percentages by group and ID

See Also

Other count spectra functions: has_enough_IDs(), has_too_few_IDs()

Examples


count_spectra(Spectra2, "class", ID = "gr")
count_spectra(OBJ = Spectra2, Var = "class", ID = "gr")


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