add_labels: Adds labels

Description Usage Arguments Details Value Examples

View source: R/utils.R

Description

Add labels to an existing collection by providing a dat frame or tibble associating sample ids to labels

Usage

1
2
3
4
add_labels(x, ...)

## S3 method for class 'collection'
add_labels(x, labels, ids_from, labels_from, ...)

Arguments

x

A collection object

...

further arguments passed to or from other methods(not currenctly used).

labels

A dataframe or tibble associating sample ids to labels

ids_from

Name of the id column

labels_from

Name of the label column

Details

Pre-existing labels will be overwritten.

Value

An updated version of collection.

Examples

1
2
3
4
5
6
7
8
library(tidySpectR)
library(tibble)

newlabs <- tibble(names = pull_ids(fa_nmr),
                  conditions = c("control", "control", "control", 
                                 "treated", "treated", "treated"))

add_labels(fa_nmr, newlabs, ids_from= "names", labels_from= "conditions")

CVUA-RRW/tidySpectR documentation built on April 13, 2021, 11:41 a.m.