R data - Changing my data frame (converting columns into rows and vice versa)

Gladdys Gotherin picture Gladdys Gotherin · Apr 8, 2013 · Viewed 31.4k times · Source

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?

Answer

jmanelsg picture jmanelsg · Apr 8, 2013

To transpose in R use the function t():

t(data)