repeat_sub: Repeat table subheadings

View source: R/repeat_sub.R

repeat_subR Documentation

Repeat table subheadings

Description

Repeat table subheadings in a new column

Usage

repeat_sub(x, column = "subheading", first = TRUE)

Arguments

x

a tibble with subheadings

column

new column name, default subheading

first

add subheader as first column, default TRUE

Details

Identifies subheadings in a data frame by checking for rows with a non-empty first column and all other columns are empty. Removes subheader rows and repeats values down a new column.

Value

a tibble

Author(s)

Chris Stubben

Examples

x <- data.frame(
  genes = c("Up", "aroB", "glnP", "Down", "ndhA", "pyrF"),
  fold_change = c(NA, 2.5, 1.7, NA, -3.1, -2.6)
)
x
repeat_sub(x)
repeat_sub(x, "regulated", first = FALSE)

tidypmc documentation built on Sept. 11, 2024, 7:17 p.m.