substr: substr

Description Usage Arguments Note See Also Examples

Description

An expression that returns a substring.

Usage

1
2
## 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 column_func: alias(), between(), cast(), endsWith(), otherwise(), over(), startsWith()

Examples

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

## End(Not run)

SparkR documentation built on June 3, 2021, 5:05 p.m.