I have a data frame in which every column contains different measurements except the first column which contains IDs. I want to create a smaller data frame which contains all columns for only those IDs which are outliers in at least one column. Here's what the data frame looks like now:
BRICK MARBLE MASONITE STEEL
ff5 1.9870268 0.3344881 0.09917627 3.205099
fdd 1.8088945 0.5292931 0.10868434 1.835525
fd9 1.2062831 0.2696240 0.12047189 3.279331
I have created vectors containing the outliers in each column using:
outliers_Marble = boxplot(Material$MARBLE, plot=FALSE)$out
I figured out how to make mini data frames that match a single outliers vector using
newframe = Material[match(outliers_Marble, Material$MARBLE,]
The part that has me stumped is applying this method to each column with the appropriate outliers vector. I know I could do each one manually then combine the data frames using but I am really hoping that someone can help me find a way to combine multiple calls of the match function into a single command. Thanks in advance.