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 7444775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:35:03+00:00 2026-05-29T11:35:03+00:00

I have a dataframe with 10 rows df <- c(1:10) How do I add

  • 0

I have a dataframe with 10 rows

df <- c(1:10)

How do I add another column to the dataframe which has only 5 rows?

df2 <- c(1:5)

Thanks for your help.

  • 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-29T11:35:04+00:00Added an answer on May 29, 2026 at 11:35 am

    I’ll give some little pointers here. See Tyler’s answer a few questions back for a couple links to materials for getting started:
    convert data.frame column format from character to factor

    1) The objects you’re making with c() are called vectors, and that is a particular kind of object in R- the most basic and useful kind.

    2) A data.frame is a kind of list where all the elements of the list are stuck together as columns and must be of the same length. The columns can be different data types (classes)

    3) lists are the most versatile kind of object in R- the elements of a list can be anything- any size, any class. This appears to be what you’re asking for.

    So for instance:

        mylist <- list(vec1 = c(1:10), vec2 = c(1:5))
        mylist
        $vec1
         [1]  1  2  3  4  5  6  7  8  9 10
        $vec2
         [1] 1 2 3 4 5
    

    There are different ways to get back at the elements of mylist, e.g.

        mylist$vec1
        mylist[1]
        mylist[[1]]
        mylist["vec1"]
        mylist[["vec1"]]
    

    and likely more! Find a tutorial by searching for ‘R beginner tutorial’ and power through it. Have fun!

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

Sidebar

Related Questions

I have a dataframe called prices_df to which I add an extra column and
Suppose I have a data.frame with N rows. The id column has 10 unique
In R I am trying to delete rows within a dataframe (ants) which have
SQLDF newbie here. I have a data frame which has about 15,000 rows and
I have a large dataframe (~ 600K rows) with a string-value column (link) doc_id,link
I have a dataframe with a column of integers that I would like to
I have a data frame where one particular column has a set of specific
I have a dataframe (14.5K rows by 15 columns) containing billing data from 2001
I have a data frame containing 10k rows, for a given column X I
I have a data frame with 22239 rows & 200 columns. The first column

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.