I need to exclude subjects from a data frame to control for external influence in the data.
I have a dataset that has subjects classified by a DOC_ID such that these are columns within my dataset
df
... DOC_ID MESURE_1 FACTOR ...
3232 -55223 alpha
3232 -2321 beta
6153 -201 alpha
6153 -233 alpha
2020 1717 beta
2020 1771 gamma
9999 39 alpha
9999 93 alpha
5353 1009 beta
5353 1091 alpha
. .
. .
. .
Now, lest say I've managed to pick out the factors I need such that :
df_temp <- subset(df, !FACTOR =="alpha")
df_temp_2 <- droplevels.data.frame(df_temp)
EXCL_df <- data.frame(summary(DSTF_ASS$Doc_ID))
subjects<- (row.names(EXCL_df))
subjects
[1] 3232 2020 5353
Levels: 3232 2020 5353
How do I exclude those DOC_ID's form the old data frame and create something like this:
df2
... DOC_ID MESURE_1 FACTOR ...
6153 -201 alpha
6153 -233 alpha
9999 39 alpha
9999 93 alpha
. .
. .
. .
I've been trying to subset, by using the subset function again, but to no avail.