[R] how to remove "numeric(0)" component from a list

Charles C. Berry cberry at tajo.ucsd.edu
Tue Jun 29 06:53:12 CEST 2010


On Mon, 28 Jun 2010, song song wrote:

> like this, the list is below,  I want to remove the last one .  not using
> newlist[-2], but using the function detect its component is numeric(0) and
> then remove it from the list.


Filter( length, newlist )

see

 	?Filter

HTH,

Chuck

>
> newlist
>
> [[1]]
> [1] 2 3
>
> [[2]]
> [1] numeric(0)
>
> [[3]]
> [1] 7
>
> 	[[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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901



More information about the R-help mailing list