add_groups_col: Add group names based on experiment name

Description Usage Arguments Examples

View source: R/add_groups_col.R

Description

Reads the experiments names from a column, and creates a new column with the group name for each experiment. Parital matchins is supported, so groups can be matched even if you add additional tags to the experiment names (e.g. 'log2_').

Usage

1
2
add_groups_col(x, samples_vector, groups_vector, samples_column,
  column_name = "groups")

Arguments

x

A dataframe that contains one column with experiments names.

samples_vector

A vector containing the experiment names.

groups_vector

A vector containing the group names for each sample of the samples_vector. Info for groups_vector and samples_vector can be stored in a separate dataframe and link the corresponding columns.

samples_column

The column name from the input dataframe that containins the sample names. Exact match of this column will be used, so write the full name.

column_name

The name of the new column that will include the group name. Default value is 'groups', and this column should not already exist in the dataframe used as input.

Examples

1
2
3
4
 grouped_data <- add_groups(x = NS_secreted_long,
                            samples_vector = groups_df$headers_raw,
                            groups_vector = groups_df$group,
                            samples_column = "variable")

tkostas/komics documentation built on May 24, 2019, 7:31 a.m.