Vayami
Vayami

Reputation: 21

subset to drop some value in column

I have a dataframe and one column has p value and I want to remove pvalue =NaN

sample  PValue
a        0.5
b        NaN
c        NaN

I want to select a data which doest'n have PValue =NaN

Is subset commmand can solve this problem

Upvotes: 0

Views: 64

Answers (2)

Matt Bannert
Matt Bannert

Reputation: 28264

There's several ways you could do it. Try:

df <- df[!is.nan(PValue),]

also look into ?is.na or ?na.omit. The latter will also omit rows with NA values in other columns.

Upvotes: 2

Jilber Urbina
Jilber Urbina

Reputation: 61154

Suppose df is your data frame

> na.omit(df)
  sample PValue
1      a    0.5

See ?na.omit for further details.

Upvotes: 1

Related Questions