R-core is not the enemy, even when they 'refuse' to do what you want
stringsAsFactors
, drop
Improve R without changing the final result of any R code
A contiguous block of memory isn't the best way to store a particular vector
Two main concepts
Easy to guess answer of:
sort(x)
when you know x
is sortedis.na(x)
when you know x
contains no NA
smatch(5, x)
/ 5 %in% x
when you know x
is sortedx < 5
when you know x
is sortedLets be real for a second - how many numbers do we need before we know everything about n:m?
Quick, ask a 3rd grader: what's the sum of three 5s, two 7s, and three more 5s?
Strings are expensive compared to numeric values. Only make the ones you need.
(this makes default rownames for big data.frames fast)
Do I really need two copies of x to know what rev(x)[4]
is?
R_NilValue
or the vector expanded to traditional form
Length
- Self explanatoryDataptr
- "Escape valve" if R internals really need a pointerElt
- retrieve value of element i without using dataptrSet_elt
- Set the value of element i without using dataptrSort_check
- Perform (and memoise) check for sortednessInspect
- info to display when inspect internal is calledIs_sorted
- immediately return known sortedness infoNo_NA
- immediately return known "no NAs" infoIs_NA
Sum
Sort
/ Order
Match
Min
/ Max
Which_min
/ Which_max
Unique
Defaults make use of sortedness and no NA info