substring in the way of pipe operator

x %s% yz

Arguments

x

Vector or NULL, values to be substringed

y.z

A character or 0.digit to call substr

Value

A string or NULL

Details

This functions is a pipe version of substr

Examples

'NFKA008' %s% '1.4'
#> [1] "NFKA"
'NFKA008' %s% .4
#> [1] "NFKA"
'where is' % % ('the pig is in the cornfield' %s% '1.7') %+% '?'
#> [1] "where is the pig?"
'NFKA008' %s% 5.7
#> [1] "008"