I looked at several posts about this error. However, I am finding that my matrices are the appropriate sizes and I'm still getting this error. I next thought the issue was class, but they are matrix objects. I'm not sure what's going on. Here is the function I'm writing:
library(Matrix)
library(MASS)
modify <- function(Vandermonde) {
    s = svd(Vandermonde)
    k = which(s$d < 1e-1)
    u = matrix(s$u[,-k], nrow = nrow(s$u), byrow = FALSE)
    v = matrix(s$v[,-k], nrow = nrow(s$v), byrow = FALSE)
    modify = u * diag(s$d[-k]) * t(v)
}
Basically, I'm writing a function that takes a rectangular matrix, checks to see if it's singular. If it is, make it non-singular. The matrix I am checking is a Vandermonde, which I create outside this function. It is rectangular because I have N rows and m powers. These are specified by whomever. I need the Vandermonde to solve the problem
V(n)*x = f(n)
where V is made of n = {1, 2, 3, 4, ..., N} and f(n) are corresponding terms of an integer sequence. An example sequence is H =
Place        Value
  1 1.000000e+00
  2 3.000000e+00
  3 1.300000e+01
  4 8.700000e+01
  5 1.053000e+03
  6 2.857600e+04
  7 2.141733e+06
  8 5.081471e+08
  9 4.021353e+11
 10 1.073376e+15
 11 9.700385e+18
 12 2.984343e+23
 13 3.147936e+28
 14 1.147438e+34
And I create the Vandermonde with
mat = matrix(0,n, m + 1)
for (i in 1:n ) {
 for (j in 1:(m + 1)) {
  mat[i,j] = input[i] ^ (j - 1) 
 }
}
where in the case of H the n = 14 and I let m = 10. To note, input is H$Place and the expected output is H$Value.
 
    