I need a variable containing all the dataframe rows df
, where x
more than y
. But for some reason, I keep getting this strange error.
> x <- c(5,6,7,8,9,10)
> y <- c(1,7,8,29,0,1)
>
> df <- data.frame(x, y)
>
> x.is.more <- df[,"x" > "y"]; x.is.more
data frame with 0 columns and 6 rows
The code above should have the same results as x.is.more <- df[c(1,6),]
, but for some reason, it doesn't work.
Anton source
share