[R] Omitting a desired line from a table [Beginner Question]
Stephan Kolassa
Stephan.Kolassa at gmx.de
Sun Jan 25 23:33:37 CET 2009
Hi,
fish.new <- fish[fish$GeoArea==1 & fish$Month==10,]
HTH,
Stephan
pfc_ivan schrieb:
> 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.
>
>
More information about the R-help
mailing list