So I have created a data frame in R with this output called 'data'
But I want to convert my data frame to something like the one below
How would I go about doing this?
To transpose in R use the function t()
:
t(data)
t(data)
returns a matrix
.
To convert it to a data.frame
from the matrix, wrap the output with
as.data.frame()`.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With