I have this dataframe:
df <- structure(list(letters = c("A", "B", "C", "D"), Number = 1:4,
Info = c("additionalinfo", "additionalinfo", "additionalinfo",
"additionalinfo")), class = "data.frame", row.names = c("1",
"2", "3", "4"))
letters Number Info
1 A 1 additionalinfo
2 B 2 additionalinfo
3 C 3 additionalinfo
4 D 4 additionalinfo
I try to add a new column combining two columns with a soft break or line break:
df %>%
mutate(answer = paste(Number, Info, sep = " \n" ))
Desired output:
Background: Within this project Randomly take wrong answers of a quiz question from dataframe column, instead of doing by hand I want to add the answer with a soft break or line break
It should print like here in the first question. Which number has E?: