Re: [R] how to remove the empty element in the vector

From: Roger D. Peng <rdpeng_at_gmail.com>
Date: Thu 19 Oct 2006 - 19:46:15 GMT

How about

x[-c(2, 3)]

-roger

Yanqin Yang wrote:
> Hello,
>
> Would anyone kindly tell me how to remove the empty element in the vector object?
> For example,
> > x
> [1] "a" "" "" "c" "c" "c" "d"

>> unique(x)

> [1] "a" "" "c" "d"
> How could I get the output like: "a","c","d"?
>
> Thanks,
>
> Yanqin
>
>
>
> ---------------------------------
> Get your email and more, right on the new Yahoo.com
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> 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.
>
-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.
Received on Fri Oct 20 11:07:29 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 20 Oct 2006 - 01:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.