# Aifelse() # Create initial dataset test<-c(12,31,42,22,26,74,49,67,20,24,55,16,39,51,72,29) # Create div3 to show if values are divisible by 3 div3<-ifelse(test%%3==0,"yes","no") # Display div3 div3 # Create div5 to show if values are divisible by 5 # As this checks every element of test we can refer to # the current element by calling test as the 'if true' vector div5<-ifelse(test%%5==0,test,0) # Display div5 div5