colLevels: Gives the distinct values of a column of data from the...

View source: R/utils_colgetters.R

colLevelsR Documentation

Gives the distinct values of a column of data from the data_frame

Description

Gives the distinct values of a column of data from the data_frame

Usage

colLevels(col, data_frame, rows.use = NULL, used.only = TRUE)

Arguments

col

quoted column name. the data column whose potential values should be retrieved.

data_frame

A data.frame.

rows.use

String vector of rows names OR an integer vector specifying the indices of rows which should be included.

Alternatively, a Logical vector, the same length as the number of rows in the data_frame, which indicates which rows to include.

used.only

TRUE by default, for target data that are factors, whether levels nonexistent in the target data should be ignored.

Value

String vector, the distinct values of the col data column (among the rows.use targeted rows) of data_frame.

Author(s)

Daniel Bunis

Examples

example("dittoExampleData", echo = FALSE)

colLevels("conditions", example_df)

# Note: Set 'used.only' (default = TRUE) to FALSE to show unused levels
#  of data that are already factors.  By default, only the used options
#  of the data will be given.
colLevels("conditions", example_df,
    rows.use = example_df$conditions!="condition1"
    )
colLevels("conditions", example_df,
    rows.use = example_df$conditions!="condition1",
    used.only = FALSE)

dittoViz documentation built on May 29, 2024, 11:15 a.m.

Related to colLevels in dittoViz...