[R] Re moving unwanted double values in list

Jim Regetz regetz at nceas.ucsb.edu
Wed Apr 29 06:12:27 CEST 2009


PDXRugger wrote:
> I have a procedure that goes sorts out some numbers based on specidifed
> criteria and for some reason the list contains double values in some of the
> rows such as:
> 
> TAZs <-
> 
> [[84]]
> [1] 638
> 
> [[85]]
> [1] 643
> 
> [[86]]
> [1] 644 732
> 
> [[87]]
> [1] 651 801
> 
> i would like to check list TAZs for double values and remove any if present. 
> I have tried 
> 
> if (length(TAZDs==2))
> 	rm(TAZDs[2])
> but no luck.  I cant find nor think of another way.  Any help would be
> helpful. Thanks in advance
> 


Try this:

TAZs[sapply(TAZs, length)!=2]

Cheers,
Jim




More information about the R-help mailing list