sort_label: Sort Grouping Variable Of Normalized Rootdetection Data Set

View source: R/helpful_functions.R

sort_labelR Documentation

Sort Grouping Variable Of Normalized Rootdetection Data Set

Description

The function will sort the grouping variable (Label) according to Controls for plotting. By defining control_fac1 and control_fac2 you can set the corresponding grouping variable (label) to the first place in order. _Caution: The column that should be ordered must be organized as a factor._

Usage

sort_label(
  root_norm,
  label_delim = ";",
  col_label = "Label",
  control_fac1,
  control_fac2
)

Arguments

root_norm

data.frame; normalized Rootdetection data set

label_delim

character; defines how Factor1 and Factor2 are separated in Label

col_label

string; name of the column carring the grouping variable (Label)

control_fac1

string; name of the control condition of grouping variable1 (Factor1)

control_fac2

string; name of the control condition of grouping variable2 (Factor2)

Value

data.frame; with sorted col_label

Examples

# obtain normalized Rootdetection data.frame
root_norm <- norm_10mm_standard(root_output)

# check the default sorting of the grouping variable (Labels)
# sorted alphabetically by default
levels(root_norm$Label)

# change order of levels by setting yucOx and 28 as controls
sort_label(root_norm, control_fac1 = "yucOx", control_fac2 = "28")

PhilippJanitza/rootdetectR documentation built on Feb. 24, 2024, 6:46 a.m.