integer - R: remove data in a logical variable using a factor variable -
i made following example code give idea of real dataset. have 2 datasets, factor variable list
, logical variable ok
.
df1 <- c("a","b","c","d","e","f","g") df2 <- c("a","d","e") list <- factor(as.integer(df1 %in% df2)) ok <- c(true,false, false,false,true,false,true)
the list
, ok
variables has both length of 7. want remove samples in list
condition true
in ok
. example: first, fifth , seventh variables need removed in list
variable.
can me this?
thanks
easier think.
list[!ok]
Comments
Post a Comment