0

I have the following dataframe which has only one column called Values and a list of string values:

Values
AA
AB
CG
DS
KI

Is there a simple way to create a string vector with each value separated by |? The desired resulting output should look something like this: Vector = "AA|AB|CG|DS|KI"

Cheers!

Economist_Ayahuasca
  • 1,147
  • 18
  • 27

1 Answers1

2

Sure, you simply use (assuming your data is called df):

paste0(df$Values, collapse = "|")
Moritz Schwarz
  • 1,021
  • 8
  • 19