calc_row_frequency: Calculate row frequencies

Description Usage Arguments Examples

View source: R/calc_row_frequency.R

Description

Identified samples for each group, reads rows and calculates the number of values above a certain threshold.

Usage

1
2
calc_row_frequency(x, sample_vector, group_vector, label = "f_",
  complete_match = FALSE, threshold = 0, drop_input = FALSE)

Arguments

x

A dataframe with the values to be normalized.

sample_vector

Vector containing column names to be used. Column names should follow the same order with the groups defined in the groups_vector argument. For example, sample names and corresponding groups can be saved on one table and refer to the specific columns. If complete matching is used, specify complete_match argument to TRUE.

group_vector

Vector containing goup names. Group_vector should have the same length with the sample_vector.

label

Character tag to be added in the columns containing the mean group frequencies. Default value is "f_".

complete_match

Logical with default value FALSE that allows partial matching of the column names for selection of the column for normalizaiton. If set to TRUE, columns that match exactly with the input will be used.

threshold

Threshold with default value = 0. By default the number of observations with frequency higher than 0 will be calculated.

drop_input

Select if you want to append the normalized data into the input dataframe or keep only them. Logical with default value FALSE, meaning that the processed values will be added to the input.

Examples

1
2
3
4
5
6
data <- data.frame(L1 = c("a", "b", "c", "d", "e", "f", "g", "h"),
                    V1 = c(1, 2, 3, 6, 1, 3, 4, 4),
                    V2 = c(3, 4, 5, 3, 5, 5, 3, 2),
                    V3 = c(6, 7, 4, 2, 3, 2, 7, 6))
calc_row_frequency(x = data, sample_vector = "V", group_vector = "my_group")
calc_row_frequency(x = data, sample_vector = "V", group_vector = "my_group", threshold = 2)

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