Skip to contents

String operators to concatenate vectors that are coercible to character strings. Vector arguments are recycled as needed.

Usage

x %+% y

x %+ % y

x %+_% y

x %+-% y

Arguments

x

a vector coercible to a character string

y

a vector coercible to a character string

Value

A vector of concatenated strings.

Examples

## Concatenate two strings
'fish' %+% 'sticks'
#> [1] "fishsticks"

## Concatenate a numeric and string
1 %+% '1'
#> [1] "11"

## Concatenate two character vectors
letters[1:5] %+% letters[1:5]
#> [1] "aa" "bb" "cc" "dd" "ee"

## Concatenate two strings with white space between
'hello' %+ % 'world'
#> [1] "hello world"

## Concatenate two character vectors with white space between
letters[1:5] %+ % letters[1:5]
#> [1] "a a" "b b" "c c" "d d" "e e"

## Concatenate two strings with an underscore between
'hello' %+_% 'world'
#> [1] "hello_world"

## Concatenate two character vectors with an underscore between
letters[1:5] %+_% letters[1:5]
#> [1] "a_a" "b_b" "c_c" "d_d" "e_e"

## Concatenate two strings with a dash between
'hello' %+-% 'world'
#> [1] "hello-world"

## Concatenate two character vectors with a dash between
letters[1:5] %+-% letters[1:5]
#> [1] "a-a" "b-b" "c-c" "d-d" "e-e"