Learn R Programming

tidypmc (version 2.0)

repeat_sub: Repeat table subheadings

Description

Repeat table subheadings in a new column

Usage

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

Value

a tibble

Arguments

x

a tibble with subheadings

column

new column name, default subheading

first

add subheader as first column, default TRUE

Author

Chris Stubben

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab