R language : list vs vector ? | SoloLearn: Learn to code for FREE!

+8

R language : list vs vector ?

In what situations is it preferable to use list or a vector in r programming?

4/8/2021 10:28:28 PM

ChillPill

1 Answer

New Answer

+5

I am no R expert but looks like the difference between them is the fact lists are recursive, means they can hold values of multiple data types. Whereas vectors are atomic, means they can only hold values of a same data type ( similar to a linked list or array in c/c++ ), and the fact that they hold similar data types should make it faster to manipulate values in it and thus should be preferred over list in such conditions. Source : https://www.burns-stat.com/documents/tutorials/impatient-r/#keyobjects