# leave only 'setosa'
rows(iris, Species == "setosa")
# leave only first five rows
rows(iris, 1:5)
# example of .N usage.
set.seed(42)
train = rows(iris, sample(.N, 100))
str(train)
set.seed(42)
test = rows(iris, -sample(.N, 100))
str(test)
Run the code above in your browser using DataLab