Message-ID: <5CEFA3E7-BD4F-40B7-B133-55661CFE6510@comcast.net>
Date: 2012-09-18T19:28:49Z
From: David Winsemius
Subject: ommoting rows
In-Reply-To: <CAAk9BOSi3QsgHU0+6RXJjNi7k49JeVwo-onRf1FGh1-+beAJsg@mail.gmail.com>
On Sep 18, 2012, at 12:08 PM, Jose Narillos de Santos wrote:
> Hi I have an output data Data.csv
>
> this style:
>
> ,"V1","V2","V3" 1,"-9552","9552","C" 2,"0","9653","0"
> 3,"9614","9614","V" 4,"0","9527","0" 5,"-9752","9752","C"
> 6,"0","9883","0" 7,"0","9865","0"
> I want to create a new matrix ommintg all the rows where third column has
> 0.
>
> There is a way to do it easyly?
>
> Many thanks in advance.
>
> My final matrix will have:
>
> ,"V1","V2","V3"1,"-9552","9552","C"
> 3,"9614","9614","V"5,"-9752","9752","C"
That text is mangled but this example of logical indexing should suffice, assuming that object is named "dat":
> dat[ !dat$V3==0, ]
V1 V2 V3
1 -9552 9552 C
3 9614 9614 V
5 -9752 9752 C
>
>
--
David Winsemius, MD
Alameda, CA, USA