rename_reference_observations: rename reference observations

Description Usage Arguments Details Value

View source: R/fun-rename_reference_observations.R

Description

Change category descriptions in a selected variable to enable prettier plotting.

Usage

1
2
3
4
5
6
7
rename_reference_observations(
  X,
  In_Variable = "treatment",
  Replacee = "nt",
  Replacers,
  return.composite = TRUE
)

Arguments

X

data frame

In_Variable

name of the variable whose values are to be altered (character)

Replacee

name of the value of In_Variable that is to be replaced (character)

Replacers

character vector of values that will replace Replacee; defaults to all other values of In_Variable

return.composite

logical flag whether to return just only reference rows or the whole data set (with references renamed)

Details

Experimental data are kept in a data frame and some observations constitute a reference group. In order to be able to show them alongside test observations, they may need to have their categorical variables altered e.g. non-treated cells can be renamed to cells treated for 0 hours.

The categorical variable can be stored as character or as a factor and this will be preserved but the replaced level will be dropped.

Grouping (by dplyr) will be preserved.

Value

A data frame. If return.composite is FALSE only the (renamed) observations will be returned. It TRUE, the returned data frame contains the renamed reference observations as well as the original non-reference observations.


olobiolo/acutils documentation built on Nov. 28, 2021, 9:35 p.m.