Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Vector, list Questions R

Posted on 2017-03-09
6
Medium Priority
?
108 Views
Last Modified: 2017-03-11
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
0
Comment
Question by:Rayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 74

Accepted Solution

by:
sdstuber earned 2000 total points
ID: 42042753
a vector is an ordered collection of elements of the same type (a vector of numbers, a vector of texts, a vector of boolean values, etc.)

a list an ordered collection of elements that can be of different types (a list containing a number, text, a date, and a boolean)

a data frame is a list of vectors

So a data frame might be envisioned as  list (vector1, vector2, vector3)

where vector1 might be a collection of ids, vector2 a collection of dates, and vector3 is a collection of names

in other words,  a data frame is rows and columns (where each column is a vector)

vector1 (ids)   vector2 (dates)   vector3 (names)
1               1969-07-20        Moon Landing
2               1953-03-26        Polio Vaccine announced
3               1930-02-18        Discovery of Pluto

Open in new window

1
 

Author Comment

by:Rayne
ID: 42043837
Thank you sdstuber :)
0
 

Author Closing Comment

by:Rayne
ID: 42043838
thank you. this explains it crystal clear
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Rayne
ID: 42043841
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
0
 
LVL 35

Expert Comment

by:sarabande
ID: 42043903
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
1
 

Author Comment

by:Rayne
ID: 42044439
Awesome, thank you Sara. this is very useful to understand :)
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question