Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6532249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:58:39+00:00 2026-05-25T09:58:39+00:00

A <- c(1,6) B <- c(2,7) C <- c(3,8) D <- c(4,9) E <-

  • 0
A <- c(1,6)
B <- c(2,7)
C <- c(3,8)
D <- c(4,9)
E <- c(5,0)
df <- data.frame(A,B,C,D,E)
df
  A B C D E
1 1 2 3 4 5
2 6 7 8 9 0

I would like to have this:

df
   1  2
A  1  6 
B  2  7
C  3  8
D  4  9    
E  5  0
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:58:39+00:00Added an answer on May 25, 2026 at 9:58 am

    If your dataframe is truly in that format, then all of your vectors will be character vectors. Or, you basically have a character matrix and you could do this:

    data.frame(t(df))
    

    It would be better, though, to just define it the way you want it from the get-go

    df <- data.frame(c('A','B','C','D','E'), 
                     c(1, 2, 3, 4, 5),
                     c(6, 7, 8, 9, 0))
    

    You could also do this

    df <- data.frame(LETTERS[1:5], 1:5, c(6:9, 0))
    

    If you wanted to give the columns names, you could do this

    df <- data.frame(L = LETTERS[1:5], N1 = 1:5, N2 = c(6:9, 0))
    

    Sometimes, if I use read.DIF of Excel data the data gets transposed. Is that how you got the original data in? If so, you can call

    read.DIF(filename, transpose = T)
    

    to get the data in the correct orientation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame with gaps like this: Var1 Var2 Var3 1 NA
Imagine I have a data frame with data like this: A | B |
I have the following question: I have data frame which looks like this. I
Let's say I have a data frame, like this: df <- data.frame( variable =
I have a factored time series that looks like this: df <- data.frame(a=c(11-JUL-2004, 11-JUL-2005,
I have data frame that looks like the following models cores time 1 4
I have a data.frame from this code: my_df = data.frame(read_time = c(2010-02-15, 2010-02-15, 2010-02-16,
I have a large data.frame, and I'd like to be able to reduce it
I have two data.frames. For examples sake let's say they look like this: df1
I have this for(i in 1:10) and within it, I have a data frame:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.