3 ms·
What is the advantage of "thinking in vectors" in R versus "thinking in vectors" using numpy in Python (for example)?
by jmcdl 5y ago
What is the advantage of "thinking in vectors" in R versus "thinking in vectors" using numpy in Python (for example)?
- carljv 5y agoThere’s some overlap, but vectors are essential to the language. Every type of data in R is a vector. There are no scalars, just vectors of length 1. Instead of dictionaries, it’s idiomatic in R to use “lists”, which are vectors of vectors. Data frames are lists (vectors of vectors) constrained to have equal length element vectors (ie columns). Classes are defined as lists with some metadata (stored in a vector) to direct method dispatch. It’s not just vectorizing mathematical operations a la numpy.