[R] string concatenation

Jiefei Wang @zwj|08 @end|ng |rom gm@||@com
Thu Nov 5 12:53:00 CET 2020


Hi,

Thanks for clarifying, there is no quote in the result. The quote in the
output is just R's way to tell you that the variable got printed is a
string. If you add quotes around a string, it will get printed like

"\"Alice, Bob, Charles\""

I hope this helps.

Best,
Jiefei

On Thu, Nov 5, 2020 at 6:51 PM Duncan Murdoch <murdoch.duncan using gmail.com>
wrote:

> On 05/11/2020 3:20 a.m., Edjabou Vincent wrote:
> > Following John request, I am wondering if it is possible to get this
> result:
> >
> > Alice, Bob, Charles (without bracket )
>
> I think you mean "without the quotes".  Use noquote():
>
>    noquote(paste0(x,collapse = ", "))
>
> will print without quotes.  (Internally the data is the same, but a
> class attribute is added that tells print() not to add quotes.)
>
> Duncan Murdoch
> >
> > Thank you for your help
> >
> >
> >
> > Med venlig hilsen/ Best regards
> >
> > Vincent Edjabou
> > Mobile: +45 31 95 99 33
> > linkedin.com/vincent
> > <http://linkedin.com/in/vincent-maklawe-edjabou-9742a41b>
> >
> > Orcid: 0000-0003-2849-6151
> >
> >
> >
> > On Thu, Nov 5, 2020 at 6:27 AM Jiefei Wang <szwjf08 using gmail.com> wrote:
> >
> >> Hi John,
> >>
> >> Try paste0(x,collapse = ", ")
> >>
> >> Best,
> >> Jiefei
> >>
> >> On Thu, Nov 5, 2020 at 1:16 PM John <miaojpm using gmail.com> wrote:
> >>
> >>> Hi,
> >>>
> >>> I have a sequence of characters:
> >>>
> >>> x <- c("Alice", "Bob", "Charles")
> >>>
> >>> How can I produce the following results:
> >>>
> >>> "Alice, Bob, Charles"
> >>>
> >>> ?
> >>>
> >>> paste? merge?
> >>>
> >>> Thank you very much!
> >>>
> >>>          [[alternative HTML version deleted]]
> >>>
> >>> ______________________________________________
> >>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide
> >>> http://www.R-project.org/posting-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >>          [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list