+ 9

R language : list vs vector ?

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

8th Apr 2021, 10:28 PM
ChillPill 🌶
ChillPill 🌶 - avatar
1 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
9th Apr 2021, 2:55 AM
Arsenic
Arsenic - avatar