YuanTian1991 / ChAMP

19 stars 22 forks source link

Check of class of beta matrix in champ.SVD returns error since R 4.0.0 #39

Open sarah-voisin opened 1 year ago

sarah-voisin commented 1 year ago

Hi,

When trying to run champ.SVD() on my beta-matrix, I get the following error: Error in if (class(beta) == "data.frame") { : the condition has length > 1 I have read here that it is because since R 4.0.0, numeric matrices have two classes ("matrix" and "array"), so champ.SVD() returns an error, as it check whether the class is equal to a particular value. Can you fix the code with something like: if (inherits(matrix_obj, "matrix"))

Thank you in advance!

Sarah