Skip to content

Getting many substrings but only loading the original string one time.

3 messages · Jonathan, Duncan Murdoch

#
On 11/04/2011 3:48 PM, Jonathan wrote:
Use substring(), not substr().  It is vectorized:

 > substring(longerString, startVector, stopVector)
[1] "ell"   "ThisI" "lo"

It does this by replicating the longerString, but that doesn't mean 
actual copies are made:  just multiple pointers to the same big one.

Duncan Murdoch