Skip to content
Prev 359455 / 398502 Next

How to remove second row if above row contain <NA>?

?complete.cases

hence, using ?which and basic indexing operations:

dat1 <- dat[ -(which(! complete.cases(dat))+1), ]

(It's a nice example of what you can do with indexing in R)

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Sun, Mar 20, 2016 at 9:50 PM, Kristi Glover
<kristi.glover at hotmail.com> wrote:
Message-ID: <CAGxFJbQN3PTd07coNotqLgLamQEpxo+c+P-Y-Qt4-iMnGdeoBw@mail.gmail.com>
In-Reply-To: <BY2PR13MB04541A7CF5BD22F0FF45D347FA8F0@BY2PR13MB0454.namprd13.prod.outlook.com>