Concatenate left-to-right (LTR) and right-to-left (RTL) text Concatenate left-to-right (LTR) and right-to-left (RTL) text r r

Concatenate left-to-right (LTR) and right-to-left (RTL) text


You may use the Unicode control characters 'left-to-right embedding', u202A ("Treat the following text as embedded left-to-right"):

paste(x, "\u202A", 123)# [1] "green أحمر أزرق ‭ 123"

See also Terminating Explicit Directional Embeddings and Overrides, (u202C), a thorough description on UNICODE BIDIRECTIONAL ALGORITHM, and here.