R-alpha: substring

Robert Gentleman (rgentlem@stat.auckland.ac.nz)
Wed, 10 Apr 1996 09:03:47 +1200


Date: Wed, 10 Apr 1996 09:03:47 +1200
From: Robert Gentleman <rgentlem@stat.auckland.ac.nz>
Message-Id: <199604092103.JAA07126@stat.auckland.ac.nz>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: substring


Well, looking at the definition of substring in S it seems that
something like 

substring := function(x,first,last=1000000)
{
        storage.mode(text) <- "character"
        n <- max(length(text), length(first), length(last))
        text <- rep(text, length = n)
        first <- rep(first, length = n)
        last <- rep(last, length = n)
        substr(text, first, last)
}

should take care of most of your needs.

robert
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-