subset data

why can't I subset data that have values from -9998 to 1000. I want to subset the data with only values greater than 0. I used the following code:

ECC1<-subset(ECC, value > 0, select = c (sensor, value))

The error says: In Ops.factor(value, 0): > not meaningful for factor.

Any clue about this error?
Hi rskgautam,

is "value" by any chance a factor?

to get a list of objects in your matrix, data.frame or whatever.

IF "value" is factor you will need to change the object from factor to numeric.

ECC$value<-as.numeric(as.character(ECC$value))## changing to character first is a must. Otherwise the values will be of.
Also - try to post an example. That will help others to understand what you are after and dealing with.

Finaly check your subset - does your code really work.

ECC1<-subset(ECC, ECC$value > 0, select = c (ECC$sensor, ECC$value))
##maybe more secure

Did this help?