[R] Omitting a desired line from a table [Beginner Question]

Jörg Groß joerg at licht-malerei.de
Sun Jan 25 23:33:32 CET 2009


fish[fish$GeoArea == 1 & fish$Month == 10]

Am 25.01.2009 um 23:06 schrieb pfc_ivan:

>
> I am a beginner using this R software and have a quick question.
>
> I added a file into the R called fish.txt using this line.
>
> fish<-read.table("fish.txt", head=T, fill=T)
>
> The .txt file looks like this. Since it contains like 300000 lines  
> of data I
> will copy/paste first 5 lines.
>
> Year GeoArea  SmpNo   Month
> 1970	    1	         13	            7	
> 1971	    1	         13	           10	
> 1972	    1	         13	            8	
> 1973	    2	         13	           10	
> 1974	    1	         13	           11	
>
> Now what I want to do is to omit all the lines in the file that arent
> happening in GeoArea 1, and that arent happening in Month 10. So  
> basically
> The only lines that I want to keep are the lines that have GeoArea=1  
> and
> Month=10 at the same time. So if GeoArea=2 and Month=10 I dont need  
> it. So i
> just need the lines that have both of those values correct. How do I  
> delete
> the rest of the lines that I dont need?
>
> Thank you everyone.
>
>
> -- 
> View this message in context: http://www.nabble.com/Omitting-a-desired-line-from-a-table--Beginner-Question--tp21657416p21657416.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.




More information about the R-help mailing list