I want to have a user-defined function that will return the first integer of a subset of a vector so that the values of the subset are unique, increasing by 1, and of a detailed length.
For example, using the input data:
v <- c(3, 4, 5, 6, 15, 16, 25, 26, 27)
l <- 3
The feasible subset of the vector would be:
c(3, 4, 5)
c(4, 5, 6)
c(25, 26, 27)
and I try to get the function to choose one of these at random and return the first/lowest number, which is either 3, 4, or 25.