Add a character before and after the word in a string in R

Viewed 12

consider this:

data.frame <- data.frame( row.names= c("A", "B", "C"), COLOR=c("blue", "black", "red"))
data.frame
    COLOR
A    blue
B   black
C    red

I would to add the character ' before and after each string in the rownames as follow:

     COLOR
'A'   blue
'B'  black
'C'    red

Please, if you can help me with some advises, I'll be grateful

0 Answers
Related