transpose a dataframe in r code example Example: r transpose dataframe iris_transpose <- as.data.frame(t(as.matrix(iris_df))) iris_transpose