Hi,
I have data frame & I want to filter two columns based on condition
df that have these variables (var1,var2,var3,var4) absDiff <- abs(w_size - z_size) > 1 #this is my condition
I want to filter out rows where absDiff is greater than one
I tried doing this filter(df,var2[absDiff)] but it didn't work
I know how to filter all with the condition filter(df,abs(w_size - z_size) > 1)
To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
As far as I understand, you want to filter some rows from only two columns. That's not possile as tibble (or data.frame) doesn't allow columns of different lengths.
If you are OK with only two columns, then you can use df %>% select(s, e) %>% filter(absCalc). Or, you'll have to filter all columns using filter(df, absCalc).