-2
> DF <- data.frame(v = factor(c("red", "blue", "green", "blue",NA,NA,NA)))
> summary(DF)
     v    
 blue :2  
 green:1  
 red  :1 
 NA: 3

I have two questions: 1)How can i remove these NA from this categorical variable? I mean i want to remove all rows from my dataframe who have NA in v. (As My original dataframe has many columns). 2)How can i remove "green" from this variable?

Aryh
  • 479
  • 1
  • 4
  • 16

1 Answers1

0

I am unable to reproduce your NAs. but in your original dataframe, you may want to perform:

DF<-na.omit(DF)

This should remove all the NAs.

Ginko-Mitten
  • 304
  • 1
  • 11