Reputation: 91
I have a dataframe with two column. I want to concatenate the values in a second column and return a string. How can I do this in R?
Upvotes: 0
Views: 85
Reputation: 886938
You can use paste
with the appropriate delimiter. Here, I am using ''
. You can specify it to -
, _
or anything else.
paste(df$Col2, collapse="")
If there are NAs
you could use na.omit
paste(na.omit(df$V2), collapse="")
Upvotes: 1