Learn R Programming

translateSPSS2R (version 1.0.0)

computeChar_rindex: Locate position of last occurence of a pattern

Description

Helper Function for xpssCompute. R Implementation of the SPSS CHAR.RINDEX Function.

Usage

computeChar_rindex (x,pattern = NULL, split = 0)

Arguments

x
atomic character or character vector.
pattern
atomic character to look for.
split
numeric. Number of parts pattern to divide to.

Value

Numeric. Position of the last occurence of the pattern

Details

computeChar_index(x="Hello user", pattern="user") Returns a number indicating the character position of the last occurrence of the first letter of 'user' in 'Hello user'. The optional third argument, split, is a number, which must be a positive integer used to divide 'user' into separate strings. The split value must be able to divide the pattern string without remainder.

See Also

str_locate_all

Examples

Run this code
xpssCompute(x="At the end i'm looking for a good end", fun="computeChar_rindex", pattern="end")

Run the code above in your browser using DataLab