Q:

How is it possible to add a space before and after string of every row

Having a dataframe with one column:
df <- data.frame(mytext = c("text1", "another one", "etc"))

How is it possible to add a space character at the start and end of every string in every row.
Example result
df <- data.frame(mytext = c(" text1 ", " another one ", " etc "))

A:

Just use the paste function:
df$mytext <- paste0(' ', df$mytext, ' ')

