KlugerLab / ALRA

Imputation method for scRNA-seq based on low-rank approximation
MIT License
73 stars 19 forks source link

modify if statement for R 4.2.0 #19

Closed inoue0426 closed 2 years ago

inoue0426 commented 2 years ago

Related to #18

From the R 4.0.0,

CHANGES IN R 4.0.0
SIGNIFICANT USER-VISIBLE CHANGES:
• matrix objects now also inherit from class "array", so e.g., class(diag(1))
is c("matrix","array"). This invalidates code incorrectly assuming that
class(matrix_obj)) has length one.
S3 methods for class "array" are now dispatched for matrix objects.

The class function will return not only 'matrix' but 'array' So if comparing as 1d like if (class(A_norm) != 'matrix') does not work. Here, I tried to implement if the class(A_norm) contains a matrix, return true.

Checklist

linqiaozhi commented 2 years ago

This is great. Thank you @inoue0426!