R Programming Language

Table of contents

  1. Data Frame/Tibble
    1. Split a DF/Tbl to a List of DF/Tbl
  2. Colours in R

Data Frame/Tibble

Split a DF/Tbl to a List of DF/Tbl

The code below will split a DF/Tbl according to the values (e.g patterns) in a column and generate a named list (dictionary) of DF/Tbls. The names/keys of the list will be the same as the values used in the criteria to split the DF/Tbl.

split (DF, criteria)
example: x <- ttest_hg %>% split(f = .$Pattern)

Colours in R

gfDevices from R core packages (

A list of very distinctive colours.
my_colours = grDevices::colors()[grep('gr(a|e)y', grDevices::colors(), invert = T)]

Generate a list of rainbow colours.
my_colours = rainbow(n, s = 1, v = 1, start = 0, end = 5/6, alpha = 1)
Where n is the number of colours you want to sample from the spectrum. Start is Red and End is magenta