aleeds444
aleeds444

Reputation: 33

How to remove certain rows from a list in R?

My document is formatted like this (though it is much longer)

1     1
1     2
2     1
1     3
3    10
10    5
5    16
16    8

And is constructed using this:

xlist<-read.table("Tree.txt")

How do I remove specific rows from this data set? I want to remove every row that begins with 1.

Thanks for the help

Upvotes: 0

Views: 82

Answers (1)

Matthew Lundberg
Matthew Lundberg

Reputation: 42659

Use logical indexing:

xlist <- xlist[xlist[[1]] != 1,]

Upvotes: 3

Related Questions