I have a data set imported in R where I am trying to remove the outliers. I did it so far that I identified all outlier values with a boxplot and saved them in a variable.
outlier_values_2 <- boxplot.stats(myfileswoNA$smart_1_raw)$out # outlier values.
boxplot(myfileswoNA$smart_1_raw, main="Outlier", boxwex=0.1)
hist(myfileswoNA$smart_1_raw)
summary(myfileswoNA$smart_1_raw)
Now I am trying to remove the lines with the identified outliers. I can do this with one certain value:
example <- myfileswoNA[myfileswoNA$smart_1_raw!=4294967295,]
But what I would like to do is to remove all outliers at once, which are stored in the variable outlier_values_2
For example this way is not working:
example <- myfileswoNA[myfileswoNA$smart_1_raw!=4294967295,]
Can anyone help me with this issue? Or does anyone have an idea?
The answer from @LAP helped me with my problem. Here is what he suggested:
If all outlier values are stored in
outlier_values_2
, trymyfileswoNA[!myfileswoNA$smart_1_raw %in% outlier_values_2,]