# All, any, and which

# Create initial dataset

test<-c(12,31,42,22,26,NA,74,49,67,20,24,55,16,NA,39,51,72,29)

# How many elements are greater than 42?

# This contains NA values, so we need to use subset() for the filter

temp<-subset(test,test>42)

# Calculate the number of elements using length()

length(temp)

# How many elements are less than 66?

# This contains NA values, so we need to use subset() for the filter
# We can do length() directly without needing temp

length(subset(test,test<66))

# Identify the indices of the even numbers

which(test%%2==0)
