[R] Omitting a desired line from a table [Beginner Question]
Kingsford Jones
kingsfordjones at gmail.com
Sun Jan 25 23:32:40 CET 2009
see
?subset
Or use indexing, which is covered in section 2.7 of an introduction to
R (but note that a data frame has 2 dimensions)
hth,
Kingsford Jones
On Sun, Jan 25, 2009 at 3:06 PM, pfc_ivan <pfc_ivan at hotmail.com> wrote:
>
> 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