top | item 27406339

(no title)

jmcdl | 4 years ago

What is the advantage of "thinking in vectors" in R versus "thinking in vectors" using numpy in Python (for example)?

discuss

order

carljv|4 years ago

There’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.