[R] Merge column with characters

ROSLINAZAIRIMAH BINTI ZAKARIA . ro@||n@z@|r|m@h @end|ng |rom ump@edu@my
Fri Nov 19 08:38:01 CET 2021


Hi Jim and all,

All functions worked beautifully. I really appreciate your help.

*Thank you and best regards.*




On Fri, Nov 19, 2021 at 4:26 AM Jim Lemon <drjimlemon using gmail.com> wrote:

> Hi RosalinaZakaria,
> Talk about using a sledgehammer to crack a nut. In your example the
> two objects are character vectors. How about:
>
> dt_comb1gd <-paste0(dtpaigd,dtpmgd)
>
> Jim
>
> On Fri, Nov 19, 2021 at 2:15 AM ROSLINAZAIRIMAH BINTI ZAKARIA .
> <roslinazairimah using ump.edu.my> wrote:
> >
> > Dear all,
> >
> > I try to merge two columns consisting of characters using the 'coalesce'
> > function from dplyr package. However, two data still have not merged,
> data
> > no. 124 1nd 143. Any help is very much appreciated. I provide the data as
> > follows.
> >
> > > dput(dtpaigd)
> > c("C+", "B+", "C+", "B+", "C+", "A-", "A ", "B+", "A-", "C ",
> > "B+", "A-", "B+", "B ", "B ", "B ", "D ", "B+", "B ", "B ", "C+",
> > "B ", "A ", "A-", "B+", "A-", "A ", "B ", "A ", "C ", "B ", "A+",
> > "C ", "B ", "B+", "C+", "B ", "B ", "C+", "B ", "B+", "B ", "A-",
> > "B+", "B ", "A-", "C+", "A ", "A-", "C+", "C+", "B ", "B+", "A-",
> > "A-", "B ", "E ", "A-", "B+", "B ", "A ", "B+", "A-", "A-", "A ",
> > "B+", "A-", "A-", "A-", "B+", "C ", "A-", "A ", "A-", "A ", "A-",
> > "A-", "A ", "A ", "B+", "B ", "A+", "B ", "B ", "B+", "A-", "B+",
> > "B+", "A-", "A-", "B+", "A-", "A-", "A-", "A-", "A-", "A ", "B+",
> > "B ", "A-", "A-", "A-", "A ", "A-", "A-", "B+", "A-", "A ", "B+",
> > "B+", "A-", "B+", "A-", "A ", "B+", "A ", "D ", "A+", "B ", "B+",
> > "A+", "B+", "B ", "", "A ", "A-", "B ", "A ", "B+", "E ", "B ",
> > "B ", "A ", "A-", "B ", "A ", "C+", "B ", "A ", "B+", "B+", "A ",
> > "", "B ")
> > > dput(dtpmgd)
> > c("", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "A-", "", "",
> > "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
> > "A ", "")
> >
> > dt_comb1gd <- coalesce(dtpaigd, dtpmgd)
> > > dput(dt_comb1gd)
> > c("C+", "B+", "C+", "B+", "C+", "A-", "A ", "B+", "A-", "C ",
> > "B+", "A-", "B+", "B ", "B ", "B ", "D ", "B+", "B ", "B ", "C+",
> > "B ", "A ", "A-", "B+", "A-", "A ", "B ", "A ", "C ", "B ", "A+",
> > "C ", "B ", "B+", "C+", "B ", "B ", "C+", "B ", "B+", "B ", "A-",
> > "B+", "B ", "A-", "C+", "A ", "A-", "C+", "C+", "B ", "B+", "A-",
> > "A-", "B ", "E ", "A-", "B+", "B ", "A ", "B+", "A-", "A-", "A ",
> > "B+", "A-", "A-", "A-", "B+", "C ", "A-", "A ", "A-", "A ", "A-",
> > "A-", "A ", "A ", "B+", "B ", "A+", "B ", "B ", "B+", "A-", "B+",
> > "B+", "A-", "A-", "B+", "A-", "A-", "A-", "A-", "A-", "A ", "B+",
> > "B ", "A-", "A-", "A-", "A ", "A-", "A-", "B+", "A-", "A ", "B+",
> > "B+", "A-", "B+", "A-", "A ", "B+", "A ", "D ", "A+", "B ", "B+",
> > "A+", "B+", "B ", "", "A ", "A-", "B ", "A ", "B+", "E ", "B ",
> > "B ", "A ", "A-", "B ", "A ", "C+", "B ", "A ", "B+", "B+", "A ",
> > "", "B ")
> >
> > *Thank you and best regards.*
> >
> > *RoslinaZakaria*
> >
> > --
> > _*
> > *_
> > _**_*
> > *__
> > _*"Think Green. Keep it on the screen.
> > If printing is
> > necessary, please print it on both sides."
> > *_
> >
> > *The information contained
> > in this e-mail message and any accompanying files is or may be
> > confidential. If you are not the intended recipient, any use,
> > dissemination, reliance, forwarding, printing or copying of this e-mail
> or
> > any attached files is unauthorized. This e-mail is subject to copyright.
> No
> > part of it should be reproduced, adapted or communicated without the
> > written consent of the copyright owner. If you have received this e-mail
> in
> > error please advise the sender immediately by return e-mail or telephone
> > and delete all copies. UMP does not guarantee the accuracy or
> completeness
> > of any information contained in this e-mail or attached files. Internet
> > communications are not secure, therefore UMP does not accept legal
> > responsibility for the contents of this message or attached files.*
> > *Universiti Malaysia Pahang <http://www.ump.edu.my>*
> >
> >         [[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.
>

-- 
_*
*_
_**_*
*__
_*"Think Green. Keep it on the screen.
If printing is 
necessary, please print it on both sides."
*_

*The information contained 
in this e-mail message and any accompanying files is or may be 
confidential. If you are not the intended recipient, any use, 
dissemination, reliance, forwarding, printing or copying of this e-mail or 
any attached files is unauthorized. This e-mail is subject to copyright. No 
part of it should be reproduced, adapted or communicated without the 
written consent of the copyright owner. If you have received this e-mail in 
error please advise the sender immediately by return e-mail or telephone 
and delete all copies. UMP does not guarantee the accuracy or completeness 
of any information contained in this e-mail or attached files. Internet 
communications are not secure, therefore UMP does not accept legal 
responsibility for the contents of this message or attached files.*
*Universiti Malaysia Pahang <http://www.ump.edu.my>*

	[[alternative HTML version deleted]]



More information about the R-help mailing list