[R] Removing a single element from an array

David Winsemius dwinsemius at comcast.net
Sun Sep 18 17:10:05 CEST 2011


On Sep 18, 2011, at 10:47 AM, Dennis Fisher wrote:

> R 2.13.1
> OS X
>
> Colleagues
>
> I frequently encounter a situation in which I want to remove a  
> single element of an array.  For example, if I am reading in a bunch  
> of CSV files, I create the list of files to be read with:
> 	LIST	<- dir()
> However, sometimes I want to exclude one or more files.  I can  
> accomplish this with a second command:
> 	LIST	<- LIST[LIST != "filename.to.be.excluded"]
> This is cumbersome -- is there some more efficient code to  
> accomplish this?

Doesn't negative indexing provide this?

?Extract

-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list