Learn R Programming

omicsTools (version 1.1.7)

transpose_df: Transpose DataFrame

Description

This function transposes a data frame by converting rows to columns and columns to rows. The first column is assumed to contain the variable names, and the remaining columns contain the values.

Usage

transpose_df(df)

Value

A transposed data frame.

Arguments

df

A data frame to be transposed.

Examples

Run this code
# Example usage:
df <- data.frame(
  ID = c("A", "B", "C"),
  Var1 = c(1, 2, 3),
  Var2 = c(4, 5, 6)
)
transpose_df(df)

Run the code above in your browser using DataLab