I\'ve written the following function based on subset()
, which I find handy:
ss <- function (x, subset, ...)
{
r <- eval(substitute(subset
I realize that the solution Ken offers is more general than just selecting items within ranges (since it should work on any logical expression) but this did remind me that Greg Snow has comparison infix operators in his Teaching Demos package:
library(TeachingDemos)
x0 <- rnorm(100)
x0[ 0 %<% x0 %<% 1.5 ]