Cat: Category Vectors

View source: R/Cat.R

CatR Documentation

Category Vectors

Description

Creates objects of type "hd_Cat". hd_Cat objects contain three main attributes: categories, n_categories and stats. With categories you can check wich values are valid for the variable. With n_categories you can check how many of valid values are valid for the variable. With the last attribute, stats, you can check different basic operations to describe the varaible (n_unique, n_na, pct_na and summary).

Usage

Cat(x = character(), categories = NULL, skip_stats = FALSE)

Arguments

x

object to be created as Cat type

categories

an optional character vector of labels for the categories

skip_stats

a logical evaluating to TRUE or FALSE indicating whether variable stats should be calculated and added to the hd_Cat object. The stats are n of unique categories, n of NA values, percentage of NA values and a frequency table.

Examples

x <- c("Apple","Banana", "Banana", "Lemons", NA)
cats <- new_Cat(x)
class(cats)
attr(cats, "stats")
attr(cats, "categories")


jpmarindiaz/homodatum documentation built on May 1, 2023, 7:24 p.m.