asked on # Vector, list Questions R

Hey all,

I am trying to get my feet wet in R programming for statistical analysis. '

Can anyone of you, tell me what is the basic differences and similarities between a list and vector, in a simple layman’s terms…

What is a data frames?

Thank you

I am trying to get my feet wet in R programming for statistical analysis. '

Can anyone of you, tell me what is the basic differences and similarities between a list and vector, in a simple layman’s terms…

What is a data frames?

Thank you

Statistical PackagesStatistical Analysis System (SAS)ProgrammingR

Log in or sign up to see answer

Become an EE member today7-DAY FREE TRIAL

Members can start a 7-Day Free trial then enjoy unlimited access to the platform

or

Learn why we charge membership fees

We get it - no one likes a content blocker. Take one extra minute and find out why we block content.

Not exactly the question you had in mind?

Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.

ask a question
Thank you sdstuber :)

thank you. this explains it crystal clear

thank you again. Now I am to totally understand the complex code that I am currently dealing with. You are a lifesaver, sent from heaven. Thank you a million

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

rwheeler23

to add to above solution:

a vector is an array, i. e. all the elements are contiguous in memory and easily can be indexed by a counter from 0 to n-1 where n is the number of elements.

a list unlike to a vector is a collection of nodes. each node contains exactly 1 list element and points backwards to a predecessor node (beside of the first node) and forward to a successor node (beside of the last node of a list). a list fastly could be grow as adding a new node only requires a maximum of two nodes to be updated while in a vector you might have to move a good part of the array or even use new bigger contiguous space when the array grows. in R lists might have elements of different type what often is the main advantage of a list especially when you deal with a small number of elements.

a dataframe is a list of column vectors as explained by ststuber.

Sara

a vector is an array, i. e. all the elements are contiguous in memory and easily can be indexed by a counter from 0 to n-1 where n is the number of elements.

a list unlike to a vector is a collection of nodes. each node contains exactly 1 list element and points backwards to a predecessor node (beside of the first node) and forward to a successor node (beside of the last node of a list). a list fastly could be grow as adding a new node only requires a maximum of two nodes to be updated while in a vector you might have to move a good part of the array or even use new bigger contiguous space when the array grows. in R lists might have elements of different type what often is the main advantage of a list especially when you deal with a small number of elements.

a dataframe is a list of column vectors as explained by ststuber.

Sara

Awesome, thank you Sara. this is very useful to understand :)