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

  • Home
  • SEARCH
  • 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 3990742
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:31:54+00:00 2026-05-20T06:31:54+00:00

My understanding as far as data frame in R is that it has to

  • 0

My understanding as far as data frame in R is that it has to be rectangular. It is not possible to have a data frame with unequal column lengths. Can I use the lists in R to achieve this? What are he pros and cons for such an approach?

  • 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-20T06:31:54+00:00Added an answer on May 20, 2026 at 6:31 am

    You can use lists to store whatever you want, even dataframes or other lists! You can indeed assign different length vectors, or even completely different objects. It gives you the same functionality as dataframes in that you can index using the dollar sign:

    > fooList <- list(a=1:12, b=1:11, c=1:10)
    > fooList$a
     [1]  1  2  3  4  5  6  7  8  9 10 11 12
    > fooDF <- data.frame(a=1:10, b=1:10, c=1:10)
    > fooDF$a
     [1]  1  2  3  4  5  6  7  8  9 10
    

    But numeric indexing is different:

    > fooList[[1]]
     [1]  1  2  3  4  5  6  7  8  9 10 11 12
    > fooDF[,1]
     [1]  1  2  3  4  5  6  7  8  9 10
    

    as well as the structure and printing method:

    > fooList
    
    
    $a
     [1]  1  2  3  4  5  6  7  8  9 10 11 12
    
    $b
     [1]  1  2  3  4  5  6  7  8  9 10 11
    
    $c
     [1]  1  2  3  4  5  6  7  8  9 10
    
    > fooDF
        a  b  c
    1   1  1  1
    2   2  2  2
    3   3  3  3
    4   4  4  4
    5   5  5  5
    6   6  6  6
    7   7  7  7
    8   8  8  8
    9   9  9  9
    10 10 10 10
    

    Simply said a dataframe is a matrix and a list more of a container.

    A list is meant to keep all sorts of stuff together, and a dataframe is the usual data format (a subject/case for each row and a variable for each column). It is used in a lot of analyses, allows to index the scores of a subject, can be more easilly transformed and other things.

    However if you have unequal length columns then I doubt each row resembles a subject/case in your data. In that case I guess you don’t need much of the functionality of dataframes.

    If each row does resemble a subject/case, then you should use NA for any missing values and use a data frame.

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

Sidebar

Related Questions

My understanding is that you have to write unit tests that isolate functionality. So
I have to make a view that shows unrelated data from multiple tables. I
In mySql, as far as my understanding goes, its possible for us to grant
I need help understanding the following. Say I have a display that is 854x480
thanks for every help that you guys have given me so far !! :D
My understanding of Hibernate is that as objects are loaded from the DB they
My understanding is that wxWidgets is for a number of programming languages (C++, Python,
My understanding is that C/C++ produces native code to run on a particular machine
My understanding is that in unix, when memory is freed, the memory doesn't get
My understanding is that C# and java differ with respect to generics in some

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.