[BioC] knn.imput and prcomp error

James W. MacDonald jmacdon at med.umich.edu
Wed Sep 20 16:36:34 CEST 2006

Ingrid H.G. Østensen wrote:
> Hi
> I am running a microarray analysis that I have run before (on the same
> data set) but now I get an error message because my matrix suddenly is no
> longer numeric. Does anybody know what happens and how do solve it? Below
> I have pasted the commands and error message.
> Ingrid
> memory.limit(1300)
> library(limma)
> library(impute)
> aneTab <- read.table(file="S100A4_anes.txt",sep="\t",header=T,na.strings="")
> colnames(aneTab)
> aneData <- aneTab[,3:14]

Are all the values in andData numeric? What do you get from str(aneData)?

If the values are not all numeric, when you coerce to a matrix 
everything will be coerced to some common type (often character). For 
instance, if there are factors and numeric values in your data.frame, 
they will all get coerced to character, which may be what is happening.



> aneData <- as.matrix(aneData)
> is.matrix(aneData)
> aneData_imp <- impute.knn(aneData)
> aneDI_prc <-prcomp(t(aneData_imp))
> Error in colMeans(x, n, prod(dn), na.rm) :
>         'x' must be numeric

James W. MacDonald, M.S.
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109

Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues.

More information about the Bioconductor mailing list