Merging cells in each rows using semicolon?
Hi all,
This may be a very basic question but I am not able to fo since last hour. I want to merge cells in each row using a comma or semicolon. The data looks like
OTU_1 23 15 273 51 127 190 220 83 k__Bacteria p__Chloroflexi c__SJA-15 o__C10_SB1A f__C10_SB1A g__Candidatus Amarilinum s__
The output would be like this
OTU_1;23;15;273;51;127;190;220;83;k__Bacteria;p__Chloroflexi;c__SJA-15;o__C10_SB1A;f__C10_SB1A;g__Candidatus Amarilinum;s__
Can you please guide how it can be done in R. I know how to use concatinate function but i am wondering if it can be done in R?
Thanks
• 949 views
•
link
0 answers
No answers yet.
Log in to answer this question.
This is off topic here as it’s just a programming question, but here’s a hint: you can use
gsubto transliterate your white space to a semicolon in R.Incidentally, I’d say this is easier to do with tools other than R.
Are these several values over several columns of a dataframe, or is it just a string?
Hello arsilan324!
We believe that this post does not fit the main topic of this site.
jrj.healey is right, this does not really qualify as bioinformatics.
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!
Provide reproducible example input data:
dput(head(mydata)).