cut.eda: Cut an EDA object.

View source: R/conversion_methods.R

cut.edaR Documentation

Cut an EDA object.

Description

Converts a numeric-type EDA object to a factor-type EDA by cutting the numeric values with the defined cutoffs. Factor-type EDAs are returned without any changes.

Usage

## S3 method for class 'eda'
cut(
  x,
  type = c("quartile", "mean", "median", "custom"),
  breaks = NULL,
  labels = NULL,
  include.lowest = TRUE,
  right = TRUE,
  default_labels = TRUE,
  na.rm = FALSE,
  ...
)

Arguments

x

an EDA object, created by eda.

type

indicates how to generate cutoffs/breaks. If 'custom', the user-specified breaks are used, otherwise the indicated statistic values are used including the minimum and maximum values of the EDA object. Defaults to quartile.

breaks

valid only for type 'custom'. Either a numeric vector of two or more unique cut points or a single number (greater than or equal to 2) giving the number of intervals into which x is to be cut.

labels

valid only for type 'custom'. For the levels of the resulting category. By default, labels are constructed using "(a,b]" interval notation. If labels = FALSE, simple integer codes are returned instead of a factor.

include.lowest

valid only for type 'custom'.Logical, indicating if an ‘x[i]’ equal to the lowest (or highest, for right = FALSE) ‘breaks’ value should be included.

right

valid only for type 'custom'. Logical, indicating if the intervals should be closed on the right (and open on the left) or vice versa.

default_labels

logical, should default labels be used for non-custom breaks? # These are: Q1 to Q4 for quartiles and H1/H2 for mean and median.

na.rm

logical, should NAs be removed prior to cutting?

...

extra arguments passed to cut.

Details

a wrapper around cut.

Value

a factor-type EDA object.


PiotrTymoszuk/ExDA documentation built on Nov. 17, 2024, 5:46 p.m.