powered by
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.
transpose_df(df)
A transposed data frame.
A data frame to be transposed.
# 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