A column of ones may be added
Examples
x <- matrix(c(5, 8, 4, 2, 7, 6), 3, 2)
EnsureIntercept(x)
#> [,1] [,2] [,3]
#> [1,] 1 5 2
#> [2,] 1 8 7
#> [3,] 1 4 6
EnsureIntercept(cbind(x, 2))
#> [,1] [,2] [,3]
#> [1,] 5 2 2
#> [2,] 8 7 2
#> [3,] 4 6 2
EnsureIntercept(cbind(x, 0))
#> [,1] [,2] [,3] [,4]
#> [1,] 1 5 2 0
#> [2,] 1 8 7 0
#> [3,] 1 4 6 0
EnsureIntercept(matrix(0, 4, 0))
#> [,1]
#> [1,] 1
#> [2,] 1
#> [3,] 1
#> [4,] 1