Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use pairlists in R?

Tags:

performance

r

I know that dotted pairlists aren't used outside of the core language for the most part, but I presumed they are used internally instead of generic vectors for a reason.

Why are pairlists used internally in R, and are there any performance benefits to using pairlists in your own functions?

like image 917
Róisín Grannell Avatar asked Jul 14 '13 06:07

Róisín Grannell


1 Answers

To answer your second question, I don't think so. Section 2.1.11 from R documentation states this:

Pairlists are handled in the R language in exactly the same way as generic vectors (“lists”). In particular, elements are accessed using the same [[]] syntax. The use of pairlists is deprecated since generic vectors are usually more efficient to use. When an internal pairlist is accessed from R it is generally (including when subsetted) converted to a generic vector.

like image 73
Arun Avatar answered Nov 20 '22 19:11

Arun