[R] trim NA from concatenate result

Kai Yang y@ngk@|9999 @end|ng |rom y@hoo@com
Thu Jun 3 01:19:34 CEST 2021


Hi Rui,
I use the code to fix my problem:
try$newcol <- gsub(" NA", "", try$newcol)

But, I'll try your solution later.
Thank you for your help.
Kai   On Wednesday, June 2, 2021, 02:08:18 PM PDT, Kai Yang via R-help <r-help using r-project.org> wrote:  
 
 Hi List,
I use paste function to concatenate  3 character columns together.
when I run table to see that, I found 3 categories. How can I write script to trim NA in 2nd and 3rd group and set the first one as NA?
Thanks,
Kai
NA NA NA 
NA NA Adenocarcinoma
NA Other NA

    [[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