Write a function that takes a number of inputs (p) and size of a subset (k) and outputs a matrix where each row is a vector of TRUE/FALSE values (k TRUE entries, p - k FALSE entries) and together the rows define all possible subsets of size k.
For example, if p = 3 and k = 2 the matrix could be
TRUE TRUE FALSE
TRUE FALSE TRUE
FALSE TRUE TRUE
Such a function would be useful for automating the best subset selection algorithm.