Learn R Programming

dittoViz (version 1.0.3)

colLevels: 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)

Value

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

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.

Author

Daniel Bunis

Examples

Run this code
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)

Run the code above in your browser using DataLab