I want to generate a nonsingular data matrix, and avoid the following error in R:
"Error in solve.default(sigma) :
system is computationally singular: reciprocal condition number = 1.3971e-16"
I am using the is.singular.matrix function in R. How to code the "discard x" part in the ifelse function?
n=100
p=50
x<-0.5*matrix(rnorm(n*p),nrow=n,ncol=p)
ifelse(is.singular.matrix(x)=T, discard x, x=x)