I have this framework that I would like to multiply (if possible, with functions dplyror base R):
df <- data.frame(x = c(1,1,1,2,2,2), y = c(30,10,8,10,18,5))
x y
1 30
1 10
1 8
2 10
2 18
2 5
Assuming x are factors (so there are 2 conditions / levels), how can I multiply / filter this data frame to get only values df$ythat are more than 15 for df$x == 1and df$yvalues that are more than 5 for df$x == 2?
This is what I would like to receive:
df2 <- data.frame(x = c(1,2,2), y = c(30,10,18))
x y
1 30
2 10
2 18
Appreciate any help! Thank!
source
share