This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while running PCAtools (Error in svd(x, nu = nu, nv = nv) : infinite or missing values in 'x')

Hello,

I am working with the qPCR dataset. The dataset had few undetected or undetermined values with NA. I am using the dataset in PCAtools library and come across the below error. It seems this is because of the of the NA values. How can I overcome this error? Is there an option in the PCAtools itself to ignore these NA values or does a library like missMDA should be used to handle missing values and then apply PCAtools? Any inputs will be helpful.

library(PCAtools)
p <- pca(Raw_Ct_values, metadata = Sample_Grouping_B12345_v1, removeVar = 0.1)

Error in svd(x, nu = nu, nv = nv) : infinite or missing values in 'x'

Thank you

Best Regards,
Toufiq

missmda r pcatools pca

1 answer

Hi,

I am the main developer of PCAtools.

Your object, Raw_Ct_values, must not contain any infinite or missing values. Further, it must be comprised of numeric values only.

Kevin

Hello Kevin Blighe

Thank you for the prompt response. This is indeed a good package with nice plots. I replaced those NA with the empty cells in the excel file and used the data in PCAtools. However, I after importing in R, I still see NA values. Please let me know how to ignore while using in PCAtools.

str(head(Raw_Counts_PCA))
'data.frame':   6 obs. of  1101 variables:
$ HC30_6h-4       : num  24.5 21.5 18.2 17.8 21.4 ...
 $ HC30_6h-12      : num  NA NA 18.8 19.8 21.8 ...
 $ 3B_6h-3         : num  20.9 18.8 16.1 16.2 17.9 ...
 $ 3B_6h-11        : num  21.4 18.3 15.5 15.4 19.5 ...
 $ 3C_6h-2         : num  20.1 17.1 14.4 14.1 17.5 ...
 $ 3C_6h-10        : num  20 16.9 13.9 14.8 19.3 ...
 $ 7A_6h-1         : num  NA 19.6 16.7 17.7 23.4 ...
 $ 7A_6h-9         : num  22.6 19.4 16.6 17.4 19.4 ...
 $ 7B_0h-1         : num  19.4 18.3 14.7 15.9 19.6 ...

Hi, this is not an issue for PCAtools to manage. You, as the analyst, need to implement a strategy of one of:

  • imputation (of the missing values)
  • case-wise deletion, i.e., deleting rows or columns that contain any missing value

Log in to answer this question.