Is there a native R function that will take an input vector and return the corresponding binary matrix where the matrix has the same number of columns as unique values in the in
Actually, contrasts is what you want.
contrasts
contrasts(as.factor(1:3), contrasts=FALSE) 1 2 3 1 1 0 0 2 0 1 0 3 0 0 1