I would like to transform the column word into another column, but with the original rows combined together, separed by _.
- Original:
> head(df, 10)
# A tibble: 10 x 1
word
<chr>
1 Jason
2 Oscar
3 Maleeka
4 Janet
5 Gabriel
6 Raheema
7 Bryce
8 Nasreen
9 Hishaam
10 Thadduse
- desired output:
word
Jason_Oscar_Maleeka_Janet_Gabriel_Raheema_Bryce_Nasreen_Hishaam_Thadduse
.
.
.
Question
1 How do I pivot word
so that each new row contains 10 words per row separated by "_" ? (Tidyverse and stringr approaches would be much appreciated - thanks!)
- Data:
> dput(df)
structure(list(word = c("Jason", "Oscar", "Maleeka", "Janet",
"Gabriel", "Raheema", "Bryce", "Nasreen", "Hishaam", "Thadduse",
"Marcos", "Daijah", "Chassity", "Carlito", "Chidiebere", "Matthew",
"Maureene", "Jillian", "Markus", "Aaron", "Ramziyya", "Marquez",
"Kiera", "Farajallah", "Larisa", "Davier", "Shujaa", "Vincent",
"Orlando", "Joseph", "Desean", "Chelsea", "Faadil", "Christopher",
"Aarifa", "Joel", "Matthew", "Jacob", "Aeones", "Matthew", "Jacob",
"Savannah", "Nadia", "Kaleem", "Tanner", "Sabeeha", "Caitlyn",
"Taylor", "Sydney", "Devin")), class = c("tbl_df", "tbl", "data.frame"
), row.names = c(NA, -50L))