Learn R Programming

psycCleaning (version 0.1.1)

effect_coding: Effect Coding

Description

Create effect-coded columns, supporting tidyselect syntax to process multiple columns simultaneously.

Usage

effect_coding(data, cols, factor = FALSE)

Value

An object of the same type as .data. The output has the following properties: 1. Columns from .data will be preserved. 2. Columns that are effect-coded.

Arguments

data

A data.frame or a data.frame extension (e.g. a tibble).

cols

Columns that need to be effect-coded. See `dplyr::dplyr_tidy_select` for available options.

factor

The default is `FALSE`. If factor is set to `TRUE`, this function returns a tibble with effect-coded factors. If factor is set to `FALSE`, this function returns a tibble with effect-coded columns.

Examples

Run this code
effect_coding(iris,Species)

Run the code above in your browser using DataLab