[R] IMPORTANT - To remove the null elements from a vector
Mario Valle
mvalle at cscs.ch
Tue Mar 9 13:51:47 CET 2010
x <- x[x != 0]
If for null elements you intend the value of zero.
Ciao!
mario
On 09-Mar-10 13:48, Barbara.Rogo at uniroma1.it wrote:
>
> I have a vector that have null elements. How to remove these elements?
> For example:
> x=[10 0 30 40 0 0] I want the vector y=[10 30 40]
> Thanks
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org 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.
--
Ing. Mario Valle
Data Analysis and Visualization Group |
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82
More information about the R-help
mailing list