Reputation: 705
Good day,
I am using boxplot
to remove the outliers from my dataset:
outliers <- boxplot(dataset, outline=FALSE);
Now as outliers variable has all information, how do I apply the removal on dataset? Does boxplot
do that inplace?
Thank you,
Upvotes: 0
Views: 44
Reputation: 33772
The values that boxplot
considers to be outliers are stored in outliers$out
. So, assuming that your dataset
contains values in a column named value
, you could remove them like this:
dataset[!dataset$value %in% outliers$out, ]
or if dataset
had only the one column:
dataset[!dataset$value %in% outliers$out, , drop = FALSE]
Upvotes: 1