transpose_df: Transpose a data frame

View source: R/transpose_df.R

transpose_dfR Documentation

Transpose a data frame

Description

[Experimental]

Is an alternative to t() to transpose a data frame. The first column of df will become column names in the transposed data.

Usage

transpose_df(df)

Arguments

df

A data frame to be transposed.

Value

A tibble containing the transposed data.

Examples


library(metan)
df <-
data.frame(
 GEN = c("G1", "G2", "G3","G4"),
 E1 = rnorm(4, 100, 20),
 E2 = rnorm(4, 10, 2),
 E3 = rnorm(4, 50, 5),
 E4 = rnorm(4, 1000, 150)
)
df
t(df)
transpose_df(df)


metan documentation built on March 7, 2023, 5:34 p.m.