substr {SparkR}R Documentation

substr

Description

An expression that returns a substring.

Usage

## S4 method for signature 'Column'
substr(x, start, stop)

Arguments

x

a Column.

start

starting position. It should be 1-base.

stop

ending position.

Note

substr since 1.4.0

See Also

Other colum_func: alias(), between(), cast(), endsWith(), otherwise(), over(), startsWith()

Examples

## Not run: 
##D df <- createDataFrame(list(list(a="abcdef")))
##D collect(select(df, substr(df$a, 1, 4))) # the result is `abcd`.
##D collect(select(df, substr(df$a, 2, 4))) # the result is `bcd`.
## End(Not run)

[Package SparkR version 3.0.0 Index]