Get a subset not containing a given value of the column
问题 I have a table called data : A 22 B 333 C Not Av. D Not Av. How can I get a subset, from which all rows containing "Not Av." are excluded? It is important to mention that I have the index of a column to be checked (in this case colnum = 2), but I don't have its name. I tried this, but it does not work: data<-subset(data,colnum!="Not Available") 回答1: df <- read.csv(text="A,22 B,333 C,Not Av. D,Not Av.", header=F) df[df[,2] != "Not Av.",] 回答2: You don't really need the subset function. Just use