News for hackers. Stuff that matters.
Re:Learn R Through Examples (2020) by jmcdl on Saturday June 05, 2021 @12:23PM (#27406339)
What is the advantage of "thinking in vectors" in R versus "thinking in vectors" using numpy in Python (for example)?
Re:Learn R Through Examples (2020) by carljv on Saturday June 05, 2021 @06:37PM (#27408980)
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.