library(cheapr)
library(bench)
# Selecting columns
sset(airquality, j = "Temp")
sset(airquality, j = 1:2)
# Selecting rows
sset(iris, 1:5)
# Rows and columns
sset(iris, 1:5, 1:5)
sset(iris, iris$Sepal.Length > 7, c("Species", "Sepal.Length"))
# Comparison against base
x <- rnorm(10^4)
mark(x[1:10^3], sset(x, 1:10^3))
mark(x[x > 0], sset(x, x > 0))
df <- data.frame(x = x)
mark(df[df$x > 0, , drop = FALSE],
sset(df, df$x > 0),
check = FALSE) # Row names are different
Run the code above in your browser using DataLab