CafféSospeso
CafféSospeso

Reputation: 1188

add characters at the beginning of a line in R

I have a simple line like:

"667778767643555099889890"

I would like to insert "\1" to the beginning of this line obtaining a final result:

"\\1667778767643555099889890"

What is the command to do it in R?

Upvotes: 7

Views: 41086

Answers (1)

Jilber Urbina
Jilber Urbina

Reputation: 61154

paste0?

> string <- "667778767643555099889890"
> paste0("\\1", string)
[1] "\\1667778767643555099889890"

Upvotes: 20

Related Questions